EnhancedPojoFormatter
, PojoFormatter
public class DefaultEnhancedPojoFormatter extends Object implements EnhancedPojoFormatter
Pojomatic
. This implementation first presents
the class name, and then each property in turn, separated by commas, using braces to indicate
nesting.
For example, if a class Person has two properties, firstName and LastName, and these properties
are using DefaultPropertyFormatter
, then the Person
instance representing Joe Blow would be represented as
"Person{firstName: {Joe}, lastName: {Blow}}"
Constructor | Description |
---|---|
DefaultEnhancedPojoFormatter() |
Modifier and Type | Method | Description |
---|---|---|
void |
appendPropertyPrefix(StringBuilder builder,
PropertyElement property) |
Append the
String prefix for a given PropertyElement to the supplied
StringBuilder. |
void |
appendPropertySuffix(StringBuilder builder,
PropertyElement property) |
Append the
String suffix for a given PropertyElement to the supplied
StringBuilder. |
void |
appendToStringPrefix(StringBuilder builder,
Class<?> pojoClass) |
Append the
String which should appear at the beginning of the result of
toString() to the supplied StringBuilder. |
void |
appendToStringSuffix(StringBuilder builder,
Class<?> pojoClass) |
Append the
String which should appear at the end of the result of
toString() to the supplied StringBuilder. |
String |
getPropertyPrefix(PropertyElement property) |
Get the
String prefix for a given PropertyElement . |
String |
getPropertySuffix(PropertyElement property) |
Get the
String suffix for a given PropertyElement . |
String |
getToStringPrefix(Class<?> pojoClass) |
Get the
String which should appear at the beginning of the result of
toString() . |
String |
getToStringSuffix(Class<?> pojoClass) |
Get the
String which should appear at the end of the result of
toString() . |
public final String getPropertyPrefix(PropertyElement property)
PojoFormatter
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.getPropertyPrefix
in interface PojoFormatter
property
- the property for which to generate a prefixpublic final String getPropertySuffix(PropertyElement property)
PojoFormatter
String
suffix for a given PropertyElement
. This method will be called
once after each call to PropertyFormatter.format(Object)
for the property's value.getPropertySuffix
in interface PojoFormatter
property
- the property for which to generate a suffixpublic final String getToStringPrefix(Class<?> pojoClass)
PojoFormatter
String
which should appear at the beginning of the result of
toString()
.getToStringPrefix
in interface PojoFormatter
pojoClass
- the class for which toString()
is being calledtoString()
Object.toString()
public final String getToStringSuffix(Class<?> pojoClass)
PojoFormatter
String
which should appear at the end of the result of
toString()
.getToStringSuffix
in interface PojoFormatter
pojoClass
- the class for which toString()
is being calledtoString()
Object.toString()
public void appendToStringPrefix(StringBuilder builder, Class<?> pojoClass)
EnhancedPojoFormatter
String
which should appear at the beginning of the result of
toString()
to the supplied StringBuilder.appendToStringPrefix
in interface EnhancedPojoFormatter
builder
- the builder to append to.pojoClass
- the class for which toString()
is being calledObject.toString()
public void appendToStringSuffix(StringBuilder builder, Class<?> pojoClass)
EnhancedPojoFormatter
String
which should appear at the end of the result of
toString()
to the supplied StringBuilder.appendToStringSuffix
in interface EnhancedPojoFormatter
builder
- the builder to append to.pojoClass
- the class for which toString()
is being calledObject.toString()
public void appendPropertyPrefix(StringBuilder builder, PropertyElement property)
EnhancedPojoFormatter
String
prefix for a given PropertyElement
to the supplied
StringBuilder. 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.appendPropertyPrefix
in interface EnhancedPojoFormatter
builder
- the builder to append to.property
- the property for which to generate a prefixpublic void appendPropertySuffix(StringBuilder builder, PropertyElement property)
EnhancedPojoFormatter
String
suffix for a given PropertyElement
to the supplied
StringBuilder. This method will be called once after each call to
PropertyFormatter.format(Object)
for the property's value.appendPropertySuffix
in interface EnhancedPojoFormatter
builder
- the builder to append to.property
- the property for which to generate a suffixCopyright © 2008–2018. All rights reserved.