net.sf.morph.transform.transformers
Class TransformerDecorator
java.lang.Object
net.sf.morph.transform.transformers.BaseTransformer
net.sf.morph.transform.transformers.TransformerDecorator
- All Implemented Interfaces:
- net.sf.composite.Component, DecoratedTransformer, ExplicitTransformer, Transformer
public class TransformerDecorator
- extends BaseTransformer
- implements DecoratedTransformer
Decorates any Transformer so that it implements DecoratedTransformer. Example usage:
Transformer myTransformer = new MyTransformer();
DecoratedTransformer decoratedTransformer = new DecoratedTransformer(myTransformer);
// now use decoratedTransformer instead of myTransformer
if (decoratedTransformer.isTransformable(destinationType, sourceType)) {
...
}
- Since:
- Dec 5, 2004
- Author:
- Matt Sgarlata
Methods inherited from class net.sf.morph.transform.transformers.BaseTransformer |
clone, convert, convert, convertImpl, 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, isImpreciseTransformationImpl, 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 |
TransformerDecorator
public TransformerDecorator()
TransformerDecorator
public TransformerDecorator(Transformer transformer)
getSourceClassesImpl
public java.lang.Class[] getSourceClassesImpl()
- Description copied from class:
BaseTransformer
Transformer.getSourceClasses()
implementation template method.
- Specified by:
getSourceClassesImpl
in class BaseTransformer
- Returns:
- Class[]
getDestinationClassesImpl
public java.lang.Class[] getDestinationClassesImpl()
- Description copied from class:
BaseTransformer
Transformer.getDestinationClasses()
implementation template method.
- Specified by:
getDestinationClassesImpl
in class BaseTransformer
- Returns:
- Class[]
isWrappingRuntimeExceptions
protected boolean isWrappingRuntimeExceptions()
- Description copied from class:
BaseTransformer
- Indicates whether runtime exceptions should be wrapped as
TransformationException
s. By default, this method returns
true
.
Simple transformers in Morph that operate on JDK types like Numbers and
Strings will usually set this value to true
so that they
throw TransformationExceptions if problems occur. More complex
transformers that operate on graphs of objects are encouraged to set this
value to false
so 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:
isWrappingRuntimeExceptions
in class BaseTransformer
- Returns:
true
getTransformer
public Transformer getTransformer()
- Returns:
- Returns the transformer.
setTransformer
public void setTransformer(Transformer transformer)
- Parameters:
transformer
- The transformer to set.
Copyright © 2004-2008.