|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.morph.transform.transformers.BaseTransformer net.sf.morph.transform.transformers.BaseReflectorTransformer net.sf.morph.transform.converters.BaseToPrettyTextConverter net.sf.morph.transform.converters.ObjectToPrettyTextConverter
public class ObjectToPrettyTextConverter
.
Creates a String representation of an object that is useful for debugging. This class is threadsafe and will not enter an infinite loop, even if displaying the information in a cyclic graph of objects.
Field Summary | |
---|---|
static int |
DEFAULT_LEVELS
Default levels |
static java.lang.Class[] |
DEFAULT_TYPES_USING_TO_STRING
Default types using toString() |
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 | |
---|---|
ObjectToPrettyTextConverter()
Create a new ObjectToPrettyTextConverter. |
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. |
Converter |
getBeanToPrettyTextConverter()
Get the converter used to convert beans to pretty text. |
Converter |
getContainerToPrettyTextConverter()
Get the converter used to convert containers to pretty text. |
int |
getLevels()
Get the levels |
protected java.lang.Class[] |
getSourceClassesImpl()
Transformer.getSourceClasses() implementation template method. |
java.lang.Class[] |
getTypesUsingToString()
Get the types using toString() . |
protected java.util.Set |
getTypesUsingToStringInternal()
Get the types using toString() . |
void |
setBeanToPrettyTextConverter(Converter beanToTextConverter)
Set the converter used to convert beans to pretty text. |
void |
setContainerToPrettyTextConverter(Converter containerToTextConverter)
Set the converter used to convert containers to pretty text. |
void |
setLevels(int levels)
Set the levels. |
void |
setTypesUsingToString(java.lang.Class[] typesUsingToString)
Set the types using toString() . |
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.Class[] DEFAULT_TYPES_USING_TO_STRING
toString()
public static final int DEFAULT_LEVELS
Constructor Detail |
---|
public ObjectToPrettyTextConverter()
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 BaseTransformer
locale
- 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 BaseReflectorTransformer
java.lang.Exception
public int getLevels()
public void setLevels(int levels)
levels
- public Converter getBeanToPrettyTextConverter()
public void setBeanToPrettyTextConverter(Converter beanToTextConverter)
beanToTextConverter
- public Converter getContainerToPrettyTextConverter()
public void setContainerToPrettyTextConverter(Converter containerToTextConverter)
containerToTextConverter
- protected java.util.Set getTypesUsingToStringInternal()
toString()
.
public java.lang.Class[] getTypesUsingToString()
toString()
.
public void setTypesUsingToString(java.lang.Class[] typesUsingToString)
toString()
.
typesUsingToString
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |