|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.morph.transform.transformers.BaseTransformer
net.sf.morph.transform.transformers.BaseReflectorTransformer
net.sf.morph.transform.converters.BaseToPrettyTextConverter
net.sf.morph.transform.converters.BeanToPrettyTextConverter
public class BeanToPrettyTextConverter
Converts a bean to a textual representation (String or StringBuffer only). The string representation is comprised of a prefix, a textual representation of the array contents, and a suffix. The textual representation of the array contents is in turn made up of the string representation of each of the elements in the array separated by a separator character. Conversions to characters will only succeed if the result of the conversion is a single character in length.
For example, if the prefix is {, the suffix is },
the separator is , and the contents of the array are the
Integers 1,2 and 3, the array
will be converted to the text {1,2,3}.
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_NAME_VALUE_SEPARATOR
Default name/value separator |
static java.lang.String |
DEFAULT_PREFIX
Default prefix |
static java.lang.String |
DEFAULT_SEPARATOR
Default separator |
static java.lang.String |
DEFAULT_SUFFIX
Default suffix |
| Fields inherited from class net.sf.morph.transform.transformers.BaseTransformer |
|---|
destinationClasses, log, sourceClasses |
| Fields inherited from interface net.sf.morph.transform.Transformer |
|---|
TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY |
| Fields inherited from interface net.sf.morph.transform.Transformer |
|---|
TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY |
| Constructor Summary | |
|---|---|
BeanToPrettyTextConverter()
Create a new BeanToPrettyTextConverter. |
|
| Method Summary | |
|---|---|
protected java.lang.Object |
convertImpl(java.lang.Class destinationClass,
java.lang.Object source,
java.util.Locale locale)
The implementation of the convert method, which may omit
the invalid argument checks already performed by this base class. |
java.lang.String |
getNameValueSeparator()
Get the name/value separator. |
protected java.lang.Class[] |
getSourceClassesImpl()
Transformer.getSourceClasses() implementation template method. |
boolean |
isShowPropertyNames()
Learn whether this BeanToPrettyTextConverter is configured to show property names. |
void |
setNameValueSeparator(java.lang.String nameValueSeparator)
Set the name/value separator. |
void |
setShowPropertyNames(boolean showPropertyNames)
Set whether this BeanToPrettyTextConverter should show property names. |
| Methods inherited from class net.sf.morph.transform.converters.BaseToPrettyTextConverter |
|---|
getDestinationClassesImpl, getIntermediateClass, getPrefix, getSeparator, getSuffix, getTextConverter, getToTextConverter, isImpreciseTransformationImpl, isPerformingLogging, isShowNullValues, isWrappingRuntimeExceptions, setPrefix, setSeparator, setShowNullValues, setSuffix, setTextConverter, setToTextConverter |
| Methods inherited from class net.sf.morph.transform.transformers.BaseReflectorTransformer |
|---|
getBeanReflector, getContainerReflector, getGrowableContainerReflector, getIndexedContainerReflector, getMutableIndexedContainerReflector, hasReflector |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.morph.transform.DecoratedConverter |
|---|
convert, equals, equals |
| Methods inherited from interface net.sf.morph.transform.Converter |
|---|
convert |
| Methods inherited from interface net.sf.morph.transform.Transformer |
|---|
getDestinationClasses, getSourceClasses |
| Methods inherited from interface net.sf.morph.transform.Transformer |
|---|
getDestinationClasses, getSourceClasses |
| Methods inherited from interface net.sf.morph.transform.ExplicitTransformer |
|---|
isTransformable |
| Methods inherited from interface net.sf.morph.transform.ImpreciseTransformer |
|---|
isImpreciseTransformation |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_PREFIX
public static final java.lang.String DEFAULT_SUFFIX
public static final java.lang.String DEFAULT_SEPARATOR
public static final java.lang.String DEFAULT_NAME_VALUE_SEPARATOR
| Constructor Detail |
|---|
public BeanToPrettyTextConverter()
| Method Detail |
|---|
protected java.lang.Object convertImpl(java.lang.Class destinationClass,
java.lang.Object source,
java.util.Locale locale)
throws java.lang.Exception
convert method, which may omit
the invalid argument checks already performed by this base class. By
default, this method creates a new instance of the destinationClass and
copies information from the source to the destination. This
implementation should be fine as-is for Copiers, but Converters will need
to implement this method since they will not be implementing the copy
method.
convertImpl in class BaseTransformerlocale - the locale in which the conversion should take place. for
converters that are not locale-aware, the local argument can
simply be ignored
java.lang.Exception
protected java.lang.Class[] getSourceClassesImpl()
throws java.lang.Exception
Transformer.getSourceClasses() implementation template method.
getSourceClassesImpl in class BaseReflectorTransformerjava.lang.Exceptionpublic java.lang.String getNameValueSeparator()
public void setNameValueSeparator(java.lang.String nameValueSeparator)
nameValueSeparator - public boolean isShowPropertyNames()
public void setShowPropertyNames(boolean showPropertyNames)
true.
showPropertyNames -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||