org.pojomatic.formatter
Class DefaultPropertyFormatter

java.lang.Object
  extended by org.pojomatic.formatter.DefaultPropertyFormatter
All Implemented Interfaces:
PropertyFormatter
Direct Known Subclasses:
AccountNumberFormatter

public class DefaultPropertyFormatter
extends java.lang.Object
implements PropertyFormatter

The default property formatter used by Pojomatic. While the particulars of the formatting strategy are subject to change, the general principle is to provide a meaningful representation. In particular, arrays are formatted "deeply", rather than simply showing the default toString representation of Java arrays.


Constructor Summary
DefaultPropertyFormatter()
           
 
Method Summary
 java.lang.String format(java.lang.Object value)
          Format a given value.
 void initialize(java.lang.reflect.AnnotatedElement element)
          Initialize the formatter for use; this method will be called exactly once on an instance, prior to any calls to PropertyFormatter.format(Object).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPropertyFormatter

public DefaultPropertyFormatter()
Method Detail

initialize

public void initialize(java.lang.reflect.AnnotatedElement element)
Description copied from interface: PropertyFormatter
Initialize the formatter for use; this method will be called exactly once on an instance, prior to any calls to PropertyFormatter.format(Object). This method does not need to be thread-safe.

Specified by:
initialize in interface PropertyFormatter
Parameters:
element - the field or method this formatter will be used for.

format

public java.lang.String format(java.lang.Object value)
Description copied from interface: PropertyFormatter
Format a given value. This method must be thread safe.

Specified by:
format in interface PropertyFormatter
Parameters:
value - the value to format
Returns:
the value, formatted (must not be null)


Copyright © 2008-2010. All Rights Reserved.