com.docmosis.template.population
Class ReflectiveDataProvider.DataFormatManager
java.lang.Object
com.docmosis.template.population.ReflectiveDataProvider.DataFormatManager
- All Implemented Interfaces:
- DataFormatter
- Enclosing class:
- ReflectiveDataProvider
- protected static class ReflectiveDataProvider.DataFormatManager
- extends Object
- implements DataFormatter
A Manager of data formats that are applied to the results
of reflective calls to format the data before it is passed into the
render process.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReflectiveDataProvider.DataFormatManager
protected ReflectiveDataProvider.DataFormatManager()
setFormatter
public void setFormatter(Class type,
DataFormatter formatter)
- Set a formatter for the given type. This formatter will be used to
render the data.
- Parameters:
type
- the class type the formatter is responsible forformatter
- the formatter that will format values of this type
removeFormatter
public void removeFormatter(Class type)
format
public String format(Class type,
Object value,
String fieldName,
Class delegateClass)
- Description copied from interface:
DataFormatter
- Format the given value and return a String to display. The class
type and fieldName are given to provide more information to the method.
Returning null is acceptable.
- Specified by:
format
in interface DataFormatter
- Parameters:
type
- the Class of the object to be formattedvalue
- the value being formattedfieldName
- the name of the field in the template that the value is
destined to populate.delegateClass
- the class of the delegate currently being interrogated. This
information may be useful when wanting to format the same types of information
differently in the context of different delegate objects.
- Returns:
- the formatted String. Null may be returned which will be blank
in the template.
Copyright © 2014 Docmosis Pty Ltd. All Rights Reserved.