net.sf.morph.transform.copiers
Class MultipleDestinationConverter

java.lang.Object
  extended by net.sf.morph.transform.transformers.BaseTransformer
      extended by net.sf.morph.transform.transformers.BaseCompositeTransformer
          extended by net.sf.morph.transform.copiers.MultipleDestinationConverter
All Implemented Interfaces:
net.sf.composite.Component, net.sf.composite.Composite, net.sf.composite.SimpleComposite, net.sf.composite.StrictlyTypedComposite, Converter, DecoratedConverter, DecoratedTransformer, ExplicitTransformer, Transformer

Deprecated. since v1.1 in favor of DisassemblerCopier

public class MultipleDestinationConverter
extends BaseCompositeTransformer
implements DecoratedConverter

A converter which takes a single object and converts it into multiple objects.

Since:
Apr 18, 2005
Author:
Matt Sgarlata

Field Summary
 
Fields inherited from class net.sf.morph.transform.transformers.BaseCompositeTransformer
components
 
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
MultipleDestinationConverter()
          Deprecated.  
 
Method Summary
protected  java.lang.Object convertImpl(java.lang.Class destinationClass, java.lang.Object source, java.util.Locale locale)
          Deprecated. The implementation of the convert method, which may omit the invalid argument checks already performed by this base class.
 java.lang.Class getComponentType()
          Deprecated. Return the component type of this transformer.
 Converter getContainerConverter()
          Deprecated. Get the container converter that will be used by this converter.
 java.lang.Class[] getDestinationClassesForEachDestination()
          Deprecated. Get the ordered array of destination classes.
protected  java.lang.Class[] getDestinationClassesImpl()
          Deprecated. Transformer.getDestinationClasses() implementation template method.
protected  java.lang.Class[] getSourceClassesImpl()
          Deprecated. Transformer.getSourceClasses() implementation template method.
protected  boolean isWrappingRuntimeExceptions()
          Deprecated. Indicates whether runtime exceptions should be wrapped as TransformationExceptions. 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).

 void setContainerConverter(Converter containerTransformer)
          Deprecated. Set the container converter that will be used by this converter.
 void setDestinationClasses(java.lang.Class[] destinationClasses)
          Deprecated. Configures the destinationClasses property of this transformer.
 void setDestinationClassesForEachDestination(java.lang.Class[] destinations)
          Deprecated. Set an ordered array of destination classes.
 void setSourceClasses(java.lang.Class[] sourceClasses)
          Deprecated. Configures the sourceClasses property of this transformer.
 
Methods inherited from class net.sf.morph.transform.transformers.BaseCompositeTransformer
getComponents, getComponentValidator, initializeImpl, isNarrowingComponentArray, setComponents, setComponentValidator, setNestedTransformer, updateNestedTransformerComponents
 
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, isAutomaticallyHandlingNulls, isCachingIsTransformableCalls, isImpreciseTransformation, isImpreciseTransformationImpl, isInitialized, isPerformingLogging, isTransformable, isTransformableImpl, setCachingIsTransformableCalls, setInitialized, setLog, setReflector, setTransformableCallCache, setTransformerName, toString
 
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
 

Constructor Detail

MultipleDestinationConverter

public MultipleDestinationConverter()
Deprecated. 
Method Detail

convertImpl

protected java.lang.Object convertImpl(java.lang.Class destinationClass,
                                       java.lang.Object source,
                                       java.util.Locale locale)
                                throws java.lang.Exception
Deprecated. 
The implementation of the 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.

Overrides:
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
Throws:
java.lang.Exception
See Also:
BaseTransformer.convertImpl(java.lang.Class, java.lang.Object, java.util.Locale)

getComponentType

public java.lang.Class getComponentType()
Deprecated. 
Return the component type of this transformer.

Specified by:
getComponentType in interface net.sf.composite.StrictlyTypedComposite
Overrides:
getComponentType in class BaseCompositeTransformer
Returns:
Class
See Also:
BaseCompositeTransformer.getComponentType()

setSourceClasses

public void setSourceClasses(java.lang.Class[] sourceClasses)
Deprecated. 
Configures the sourceClasses property of this transformer. Note that this method should be called before the transformer is used. Otherwise, if another thread is in the middle of transforming an object graph and this method is called, the behavior of the transformer can change partway through the transformation.

Overrides:
setSourceClasses in class BaseTransformer
Parameters:
sourceClasses - the new sourceClasses for this transformer
See Also:
BaseTransformer.setSourceClasses(java.lang.Class[])

getSourceClassesImpl

protected java.lang.Class[] getSourceClassesImpl()
                                          throws java.lang.Exception
Deprecated. 
Transformer.getSourceClasses() implementation template method.

Specified by:
getSourceClassesImpl in class BaseTransformer
Returns:
Class[]
Throws:
java.lang.Exception
See Also:
BaseTransformer.getSourceClassesImpl()

setDestinationClasses

public void setDestinationClasses(java.lang.Class[] destinationClasses)
Deprecated. 
Configures the destinationClasses property of this transformer. Note that this method should be called before the transformer is used. Otherwise, if another thread is in the middle of transforming an object graph and this method is called, the behavior of the transformer can change partway through the transformation.

Overrides:
setDestinationClasses in class BaseTransformer
Parameters:
destinationClasses - the new destinationClasses for this transformer
See Also:
BaseTransformer.setDestinationClasses(java.lang.Class[])

getDestinationClassesImpl

protected java.lang.Class[] getDestinationClassesImpl()
                                               throws java.lang.Exception
Deprecated. 
Transformer.getDestinationClasses() implementation template method.

Specified by:
getDestinationClassesImpl in class BaseTransformer
Returns:
Class[]
Throws:
java.lang.Exception
See Also:
BaseTransformer.getDestinationClassesImpl()

getContainerConverter

public Converter getContainerConverter()
Deprecated. 
Get the container converter that will be used by this converter.

Returns:
Converter

setContainerConverter

public void setContainerConverter(Converter containerTransformer)
Deprecated. 
Set the container converter that will be used by this converter.

Parameters:
containerTransformer - Converter

getDestinationClassesForEachDestination

public java.lang.Class[] getDestinationClassesForEachDestination()
Deprecated. 
Get the ordered array of destination classes.

Returns:
Class[]

setDestinationClassesForEachDestination

public void setDestinationClassesForEachDestination(java.lang.Class[] destinations)
Deprecated. 
Set an ordered array of destination classes.

Parameters:
destinations -

isWrappingRuntimeExceptions

protected boolean isWrappingRuntimeExceptions()
Deprecated. 
Indicates whether runtime exceptions should be wrapped as TransformationExceptions. 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 BaseCompositeTransformer
Returns:
true
See Also:
BaseCompositeTransformer.isWrappingRuntimeExceptions()


Copyright © 2004-2008.