net.sf.morph.transform.converters
Class ObjectToTextConverter
java.lang.Object
   net.sf.morph.transform.transformers.BaseTransformer
net.sf.morph.transform.transformers.BaseTransformer
       net.sf.morph.transform.converters.ObjectToTextConverter
net.sf.morph.transform.converters.ObjectToTextConverter
- All Implemented Interfaces: 
- net.sf.composite.Component, Converter, DecoratedConverter, DecoratedTransformer, ExplicitTransformer, ImpreciseTransformer, Transformer
- public class ObjectToTextConverter 
- extends BaseTransformer- implements DecoratedConverter, ImpreciseTransformer
Converts an object to a textual representation by calling the object's
 toString method. Textual representations include
 Strings, StringBuffers and
 Characters. Conversions to characters will only succeed if
 the result of the conversion is a single character in length.
- Since:
- Dec 24, 2004
- Author:
- Matt Sgarlata
 
 
 
 
 
 
| Methods inherited from class net.sf.morph.transform.transformers.BaseTransformer | 
| clone, convert, convert, copy, copy, copyImpl, createDefaultReflector, createNewInstance, createNewInstanceImpl, createReusableSource, equals, equals, equalsUnidirectionalTest, getDestinationClasses, getInstantiatingReflector, getLocale, getLog, getNestedTransformer, getReflector, getReflector, getSourceClasses, getTransformableCallCache, getTransformerName, initialize, initializeImpl, isAutomaticallyHandlingNulls, isCachingIsTransformableCalls, isImpreciseTransformation, isInitialized, isPerformingLogging, isTransformable, isTransformableImpl, setCachingIsTransformableCalls, setDestinationClasses, setInitialized, setLog, setNestedTransformer, setReflector, setSourceClasses, setTransformableCallCache, setTransformerName, toString | 
 
| Methods inherited from class java.lang.Object | 
| equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
 
 
 
 
 
 
 
ObjectToTextConverter
public ObjectToTextConverter()
convertImpl
protected java.lang.Object convertImpl(java.lang.Class destinationClass,
                                       java.lang.Object source,
                                       java.util.Locale locale)
                                throws java.lang.Exception
- The implementation of the convertmethod, 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.
 
- 
- Overrides:
- convertImplin 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
- Throws:
- java.lang.Exception
 
isImpreciseTransformationImpl
protected boolean isImpreciseTransformationImpl(java.lang.Class destinationClass,
                                                java.lang.Class sourceClass)
- Implementation of isImpreciseTransformation
 
- 
- Overrides:
- isImpreciseTransformationImplin class- BaseTransformer
 
- 
- Returns:
- boolean
 
isWrappingRuntimeExceptions
protected boolean isWrappingRuntimeExceptions()
- Indicates whether runtime exceptions should be wrapped as
 TransformationExceptions. By default, this method returnstrue.
 Simple transformers in Morph that operate on JDK types like Numbers and
 Strings will usually set this value to trueso that they
 throw TransformationExceptions if problems occur. More complex
 transformers that operate on graphs of objects are encouraged to set this
 value tofalseso that runtime exceptions are not wrapped.
 This way, problems accessing data will be expressed by the native API of
 a user's domain objects and avoid the need to catch Morph-specific
 exceptions (assuming the use of runtime exceptions in said domain
 objects).
 
 
- 
- Overrides:
- isWrappingRuntimeExceptionsin class- BaseTransformer
 
- 
- Returns:
- true
 
getSourceClassesImpl
protected java.lang.Class[] getSourceClassesImpl()
                                          throws java.lang.Exception
- Transformer.getSourceClasses()implementation template method.- 
 
- 
- Specified by:
- getSourceClassesImplin class- BaseTransformer
 
- 
- Returns:
- Class[]
- Throws:
- java.lang.Exception
 
getDestinationClassesImpl
protected java.lang.Class[] getDestinationClassesImpl()
                                               throws java.lang.Exception
- Transformer.getDestinationClasses()implementation template method.- 
 
- 
- Specified by:
- getDestinationClassesImplin class- BaseTransformer
 
- 
- Returns:
- Class[]
- Throws:
- java.lang.Exception
 
getTextConverter
public Converter getTextConverter()
- Get the text converter used by this ObjectToTextConverter.
 
- 
 
- 
- Returns:
- Converter
 
setTextConverter
public void setTextConverter(Converter textConverter)
- Set the text converter used by this ObjectToTextConverter.
 
- 
 
- 
- Parameters:
- textConverter-
 
Copyright © 2004-2008.