org.pojomatic.formatter
Interface PojoFormatter

All Known Implementing Classes:
DefaultPojoFormatter

public interface PojoFormatter

A formatter to aid in creating a String representation of a POJO. A new instance will be created for each time that Pojomator.doToString(Object) is called.


Method Summary
 java.lang.String getPropertyPrefix(PropertyElement property)
          Get the String prefix for a given PropertyElement.
 java.lang.String getPropertySuffix(PropertyElement property)
          Get the String suffix for a given PropertyElement.
 java.lang.String getToStringPrefix(java.lang.Class<?> pojoClass)
          Get the String which should appear at the beginning of the result of toString().
 java.lang.String getToStringSuffix(java.lang.Class<?> pojoClass)
          Get the String which should appear at the end of the result of toString().
 

Method Detail

getToStringPrefix

java.lang.String getToStringPrefix(java.lang.Class<?> pojoClass)
Get the String which should appear at the beginning of the result of toString().

Parameters:
pojoClass - the class for which toString() is being called
Returns:
the prefix to appear at the beginning of the result of toString()
See Also:
Object.toString()

getToStringSuffix

java.lang.String getToStringSuffix(java.lang.Class<?> pojoClass)
Get the String which should appear at the end of the result of toString().

Parameters:
pojoClass - the class for which toString() is being called
Returns:
the suffix to appear at the end of the result of toString()
See Also:
Object.toString()

getPropertyPrefix

java.lang.String getPropertyPrefix(PropertyElement property)
Get the String prefix for a given PropertyElement. This method will be called once for each property used in the result of toString(), in the order in which those properties will appear in that result, and before the call to PropertyFormatter.format(Object) for the property's value.

Parameters:
property - the property for which to generate a prefix
Returns:
the prefix for the given property

getPropertySuffix

java.lang.String getPropertySuffix(PropertyElement property)
Get the String suffix for a given PropertyElement. This method will be called once after each call to PropertyFormatter.format(Object) for the property's value.

Parameters:
property - the property for which to generate a suffix
Returns:
the suffix for the given property


Copyright © 2008-2010. All Rights Reserved.