Docmosis API 4.5.0

com.docmosis.template.population
Class ReflectiveDataProvider.DataFormatManager

java.lang.Object
  extended bycom.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.


Constructor Summary
protected ReflectiveDataProvider.DataFormatManager()
           
 
Method Summary
 String format(Class type, Object value, String fieldName, Class delegateClass)
          Format the given value and return a String to display.
 void removeFormatter(Class type)
           
 void setFormatter(Class type, DataFormatter formatter)
          Set a formatter for the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectiveDataProvider.DataFormatManager

protected ReflectiveDataProvider.DataFormatManager()
Method Detail

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 for
formatter - 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 formatted
value - the value being formatted
fieldName - 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.

Docmosis API 4.5.0

Copyright © 2014 Docmosis Pty Ltd. All Rights Reserved.