net.sf.morph.transform
Interface NodeCopier

All Superinterfaces:
net.sf.composite.Component, Copier, Transformer
All Known Implementing Classes:
ArrayCopier, BasePropertyNameCopier, ContainerCopier, ContainerOfBeansCopier, MapCopier, PropertyExpressionMappingCopier, PropertyNameMappingCopier, PropertyNameMatchingCopier

public interface NodeCopier
extends Copier

A copier used by a net.sf.morph.transform.GraphTransformer to assist in the transformation of one object graph into another object graph. A node copier is responsible for transforming a single node in the graph. The GraphTransformer chooses the appropriate node transformer for each node in the object graph.

Since:
Feb 22, 2005
Author:
Matt Sgarlata

Field Summary
 
Fields inherited from interface net.sf.morph.transform.Transformer
TRANSFORMATION_TYPE_CONVERT, TRANSFORMATION_TYPE_COPY
 
Method Summary
 java.lang.Object createNewInstance(java.lang.Class destinationClass, java.lang.Object source)
          Creates a new instance of the destination class that is capable of holding the information contained in the given source.
 java.lang.Object createReusableSource(java.lang.Class destinationClass, java.lang.Object source)
          Returns a version of the given source object that can be used multiple times by this copier.
 Transformer getNestedTransformer()
          Retrieves the transformer used to perform nested transformations.
 void setNestedTransformer(Transformer nestedTransformer)
          Sets the transformer used to perform nested transformations.
 
Methods inherited from interface net.sf.morph.transform.Copier
copy
 
Methods inherited from interface net.sf.morph.transform.Transformer
getDestinationClasses, getSourceClasses
 

Method Detail

createReusableSource

java.lang.Object createReusableSource(java.lang.Class destinationClass,
                                      java.lang.Object source)
Returns a version of the given source object that can be used multiple times by this copier. In most cases, a source object is reusable without changes and is simply returned. However, in some cases a source object may be a "throw-away" object that can only be used once. A good example of this is traversal objects like Iterators and Enumerations. For objects like these, the information must be copied to a reuseable object before being used

Parameters:
destinationClass - the destination class to which this source object will be transformed
source - a source object that will undergo a transformation by this copier
Returns:
a reusable version of fthe source object

createNewInstance

java.lang.Object createNewInstance(java.lang.Class destinationClass,
                                   java.lang.Object source)
Creates a new instance of the destination class that is capable of holding the information contained in the given source.

Parameters:
destinationClass - the type of the new instance to be returned
source - the source to be transformed by this transformer
Returns:
the new instance

getNestedTransformer

Transformer getNestedTransformer()
Retrieves the transformer used to perform nested transformations.

Returns:
the transformer used to perform nested transformations

setNestedTransformer

void setNestedTransformer(Transformer nestedTransformer)
Sets the transformer used to perform nested transformations.

Parameters:
nestedTransformer - the transformer used to perform nested transformations


Copyright © 2004-2008.