Package org.dspace.content.license

Source Code of org.dspace.content.license.SimpleDSpaceObjectLicenseFormatter

package org.dspace.content.license;

import java.util.Formatter;

import org.dspace.content.DSpaceObject;

/**
* This is a simple implementation of the LicenseArgumentFormatter for a
* DSpaceObject. The formatter options width/precision are not take in care.
*
* @author bollini
*
*/
public class SimpleDSpaceObjectLicenseFormatter implements
        LicenseArgumentFormatter
{
    public void formatTo(Formatter formatter, int flags, int width,
            Object object, String type)
    {
        if (object == null)
        {
            formatter.format("sample "+type);
        }
        else
        {
            DSpaceObject dso = (DSpaceObject) object;
            String name = dso.getName();
            if (name != null)
            {
                formatter.format(name);
            }
            else
            {
                formatter.format("");
            }
        }
    }
}
TOP

Related Classes of org.dspace.content.license.SimpleDSpaceObjectLicenseFormatter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.