com.docmosis.template.population.format
Class DateDataFormatter
java.lang.Object
com.docmosis.template.population.format.DateDataFormatter
- All Implemented Interfaces:
- DataFormatter, Serializable
- public class DateDataFormatter
- extends Object
- implements DataFormatter, Serializable
A formatter for formatting dates. Underneath the formatter
uses a java.text.SimpleDateFormat object to do the formatting
and takes care of synchronization around it just in case it
is used in multiple threads (since SimpleDateFormat is not
thread safe).
Note: the format() method will throw IllegalArgumentExceptions
if the date format is not a legal format for SimpleDateFormat.
- See Also:
- Serialized Form
Constructor Summary |
DateDataFormatter(String formatString)
Construct a new DateDataFormatter using the given format
string as the format for a SimpleDateFormat. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateDataFormatter
public DateDataFormatter(String formatString)
- Construct a new DateDataFormatter using the given format
string as the format for a SimpleDateFormat.
- Parameters:
formatString
-
format
public String format(Class type,
Object value,
String fieldName,
Class delegateClass)
- Format the given value and return a String to display.
- Specified by:
format
in interface DataFormatter
- Parameters:
type
- the Class of the object to be formatted. Ignored by this implementation.value
- the value being formattedfieldName
- the name of the field in the template that the value is
destined to populate. Ignored by this implementation.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. Ignored by this implementation.
- Returns:
- the formatted String. Null may be returned which will be blank
in the template.
Copyright © 2014 Docmosis Pty Ltd. All Rights Reserved.