net.sf.beanlib.provider
Class BeanTransformer

java.lang.Object
  extended by net.sf.beanlib.provider.replicator.ReplicatorTemplate
      extended by net.sf.beanlib.provider.BeanTransformer
All Implemented Interfaces:
BeanPopulatorBaseSpi, BeanTransformerSpi, Transformable
Direct Known Subclasses:
Hibernate3BeanTransformer

@NotThreadSafe
public class BeanTransformer
extends ReplicatorTemplate
implements BeanTransformerSpi

Bean Transformer.

Author:
Joe D. Velopar

Nested Class Summary
private static class BeanTransformer.Factory
          Bean Transformer Factory.
 
Field Summary
private  ArrayReplicatorSpi arrayReplicatable
           
private  BeanPopulatorBaseConfig baseConfig
           
private  BeanPopulatorSpi.Factory beanPopulatorFactory
           
private  BeanReplicatorSpi beanReplicatable
           
private  BlobReplicatorSpi blobReplicatable
           
private  Map<Object,Object> clonedMap
           
private  CollectionReplicatorSpi collectionReplicatable
           
private  CustomBeanTransformerSpi customTransformer
          Custom Transformer.
private  DateReplicatorSpi dateReplicatable
           
private static BeanTransformer.Factory factory
           
private  ImmutableReplicatorSpi immutableReplicatable
           
private  MapReplicatorSpi mapReplicatable
           
 
Fields inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
log
 
Constructor Summary
protected BeanTransformer(BeanPopulatorSpi.Factory beanPopulatorFactory)
           
 
Method Summary
 ArrayReplicatorSpi getArrayReplicatable()
           
 BeanPopulatorBaseConfig getBeanPopulatorBaseConfig()
          Don't invoke this method, except from within the replicator implementation class.
 BeanPopulatorSpi.Factory getBeanPopulatorSpiFactory()
           
 BeanReplicatorSpi getBeanReplicatable()
           
 BlobReplicatorSpi getBlobReplicatable()
           
<K,V> Map<K,V>
getClonedMap()
           
 CollectionReplicatorSpi getCollectionReplicatable()
           
 DateReplicatorSpi getDateReplicatable()
           
 ImmutableReplicatorSpi getImmutableReplicatable()
           
 MapReplicatorSpi getMapReplicatable()
           
 BeanTransformer initArrayReplicatable(ArrayReplicatorSpi.Factory arrayReplicatableFactory)
           
 BeanTransformer initBeanPopulatable(BeanPopulatable beanPopulatable)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
 BeanTransformer initBeanPopulationExceptionHandler(BeanPopulationExceptionHandler beanPopulationExceptionHandler)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
 BeanTransformerSpi initBeanPopulatorBaseConfig(BeanPopulatorBaseConfig baseConfig)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
 BeanTransformer initBeanReplicatable(BeanReplicatorSpi.Factory objectReplicatableFactory)
           
 BeanTransformer initBeanSourceHandler(BeanSourceHandler beanSourceHandler)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
 BeanTransformer initBlobReplicatable(BlobReplicatorSpi.Factory blobReplicatableFactory)
           
 BeanTransformer initCollectionReplicatable(CollectionReplicatorSpi.Factory factory)
           
 BeanTransformer initCustomTransformer(CustomBeanTransformerSpi.Factory customTransformer)
           
 BeanTransformerSpi initDateReplicatable(DateReplicatorSpi.Factory dateReplicatableFactory)
           
 BeanTransformer initDebug(boolean debug)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
 BeanTransformer initDetailedBeanPopulatable(DetailedBeanPopulatable detailedBeanPopulatable)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
 BeanTransformer initImmutableReplicatable(ImmutableReplicatorSpi.Factory immutableReplicatableFactory)
           
 BeanTransformer initMapReplicatable(MapReplicatorSpi.Factory factory)
           
 BeanTransformer initReaderMethodFinder(BeanMethodFinder readerMethodFinder)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
 BeanTransformer initSetterMethodCollector(BeanMethodCollector setterMethodCollector)
          Don't invoke this method, except from within the BeanPopulatorSpi implementation class.
static BeanTransformer newBeanTransformer()
          Convenient factory method that defaults to use BeanPopulator.factory.
static BeanTransformer newBeanTransformer(BeanPopulatorSpi.Factory beanPopulatorFactory)
           
 void reset()
           
<T> T
transform(Object from, Class<T> toClass, PropertyInfo propertyInfo)
          Returns an object transformed from the input object with the given target class.
 
Methods inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
chooseClass, createToInstance, createToInstance, createToInstanceWithComparator, getTargetCloned, newInstanceAsPrivileged, populateBean, putTargetCloned, replicate, replicate, replicateByBeanReplicatable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

private static final BeanTransformer.Factory factory

beanPopulatorFactory

private final BeanPopulatorSpi.Factory beanPopulatorFactory

clonedMap

private Map<Object,Object> clonedMap

baseConfig

private BeanPopulatorBaseConfig baseConfig

customTransformer

private CustomBeanTransformerSpi customTransformer
Custom Transformer.


immutableReplicatable

private ImmutableReplicatorSpi immutableReplicatable

collectionReplicatable

private CollectionReplicatorSpi collectionReplicatable

mapReplicatable

private MapReplicatorSpi mapReplicatable

arrayReplicatable

private ArrayReplicatorSpi arrayReplicatable

blobReplicatable

private BlobReplicatorSpi blobReplicatable

dateReplicatable

private DateReplicatorSpi dateReplicatable

beanReplicatable

private BeanReplicatorSpi beanReplicatable
Constructor Detail

BeanTransformer

protected BeanTransformer(BeanPopulatorSpi.Factory beanPopulatorFactory)
Method Detail

newBeanTransformer

public static BeanTransformer newBeanTransformer(BeanPopulatorSpi.Factory beanPopulatorFactory)

newBeanTransformer

public static BeanTransformer newBeanTransformer()
Convenient factory method that defaults to use BeanPopulator.factory.


getBeanPopulatorSpiFactory

public BeanPopulatorSpi.Factory getBeanPopulatorSpiFactory()
Specified by:
getBeanPopulatorSpiFactory in interface BeanTransformerSpi

reset

public final void reset()
Specified by:
reset in interface BeanTransformerSpi

transform

public final <T> T transform(Object from,
                             Class<T> toClass,
                             PropertyInfo propertyInfo)
Description copied from interface: Transformable
Returns an object transformed from the input object with the given target class.

Specified by:
transform in interface Transformable
Overrides:
transform in class ReplicatorTemplate
Parameters:
from - the input object to be transformed. If propertyInfo is non-null, the input object is a JavaBean property value.
toClass - the target class to be transformed to.
propertyInfo - If null, it means the in object is a root level object. Otherwise, propertyInfo contains information about the input object as a java bean property value to be transformed.
Returns:
the transformed object.

initCustomTransformer

public final BeanTransformer initCustomTransformer(CustomBeanTransformerSpi.Factory customTransformer)
Specified by:
initCustomTransformer in interface BeanTransformerSpi

initBeanPopulatable

public final BeanTransformer initBeanPopulatable(BeanPopulatable beanPopulatable)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initBeanPopulatable in interface BeanPopulatorBaseSpi
Specified by:
initBeanPopulatable in interface BeanTransformerSpi

initBeanSourceHandler

public final BeanTransformer initBeanSourceHandler(BeanSourceHandler beanSourceHandler)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initBeanSourceHandler in interface BeanPopulatorBaseSpi
Specified by:
initBeanSourceHandler in interface BeanTransformerSpi

initDebug

public final BeanTransformer initDebug(boolean debug)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initDebug in interface BeanPopulatorBaseSpi
Specified by:
initDebug in interface BeanTransformerSpi

initDetailedBeanPopulatable

public final BeanTransformer initDetailedBeanPopulatable(DetailedBeanPopulatable detailedBeanPopulatable)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initDetailedBeanPopulatable in interface BeanPopulatorBaseSpi
Specified by:
initDetailedBeanPopulatable in interface BeanTransformerSpi

initReaderMethodFinder

public final BeanTransformer initReaderMethodFinder(BeanMethodFinder readerMethodFinder)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initReaderMethodFinder in interface BeanPopulatorBaseSpi
Specified by:
initReaderMethodFinder in interface BeanTransformerSpi

initSetterMethodCollector

public final BeanTransformer initSetterMethodCollector(BeanMethodCollector setterMethodCollector)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initSetterMethodCollector in interface BeanPopulatorBaseSpi
Specified by:
initSetterMethodCollector in interface BeanTransformerSpi

initCollectionReplicatable

public BeanTransformer initCollectionReplicatable(CollectionReplicatorSpi.Factory factory)
Specified by:
initCollectionReplicatable in interface BeanTransformerSpi

getCollectionReplicatable

public CollectionReplicatorSpi getCollectionReplicatable()
Specified by:
getCollectionReplicatable in interface BeanTransformerSpi

initMapReplicatable

public BeanTransformer initMapReplicatable(MapReplicatorSpi.Factory factory)
Specified by:
initMapReplicatable in interface BeanTransformerSpi

getMapReplicatable

public MapReplicatorSpi getMapReplicatable()
Specified by:
getMapReplicatable in interface BeanTransformerSpi

getClonedMap

public <K,V> Map<K,V> getClonedMap()
Specified by:
getClonedMap in interface BeanTransformerSpi

initImmutableReplicatable

public BeanTransformer initImmutableReplicatable(ImmutableReplicatorSpi.Factory immutableReplicatableFactory)
Specified by:
initImmutableReplicatable in interface BeanTransformerSpi

getImmutableReplicatable

public ImmutableReplicatorSpi getImmutableReplicatable()
Specified by:
getImmutableReplicatable in interface BeanTransformerSpi

initArrayReplicatable

public BeanTransformer initArrayReplicatable(ArrayReplicatorSpi.Factory arrayReplicatableFactory)
Specified by:
initArrayReplicatable in interface BeanTransformerSpi

getArrayReplicatable

public ArrayReplicatorSpi getArrayReplicatable()
Specified by:
getArrayReplicatable in interface BeanTransformerSpi

initBlobReplicatable

public BeanTransformer initBlobReplicatable(BlobReplicatorSpi.Factory blobReplicatableFactory)
Specified by:
initBlobReplicatable in interface BeanTransformerSpi

getBlobReplicatable

public BlobReplicatorSpi getBlobReplicatable()
Specified by:
getBlobReplicatable in interface BeanTransformerSpi

initBeanReplicatable

public BeanTransformer initBeanReplicatable(BeanReplicatorSpi.Factory objectReplicatableFactory)
Specified by:
initBeanReplicatable in interface BeanTransformerSpi

getBeanReplicatable

public BeanReplicatorSpi getBeanReplicatable()
Specified by:
getBeanReplicatable in interface BeanTransformerSpi

initDateReplicatable

public BeanTransformerSpi initDateReplicatable(DateReplicatorSpi.Factory dateReplicatableFactory)
Specified by:
initDateReplicatable in interface BeanTransformerSpi

getDateReplicatable

public DateReplicatorSpi getDateReplicatable()
Specified by:
getDateReplicatable in interface BeanTransformerSpi

initBeanPopulationExceptionHandler

public BeanTransformer initBeanPopulationExceptionHandler(BeanPopulationExceptionHandler beanPopulationExceptionHandler)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initBeanPopulationExceptionHandler in interface BeanPopulatorBaseSpi
Specified by:
initBeanPopulationExceptionHandler in interface BeanTransformerSpi

initBeanPopulatorBaseConfig

public BeanTransformerSpi initBeanPopulatorBaseConfig(BeanPopulatorBaseConfig baseConfig)
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the BeanPopulatorSpi implementation class.

Specified by:
initBeanPopulatorBaseConfig in interface BeanPopulatorBaseSpi
Specified by:
initBeanPopulatorBaseConfig in interface BeanTransformerSpi

getBeanPopulatorBaseConfig

public BeanPopulatorBaseConfig getBeanPopulatorBaseConfig()
Description copied from interface: BeanTransformerSpi
Don't invoke this method, except from within the replicator implementation class.

Specified by:
getBeanPopulatorBaseConfig in interface BeanTransformerSpi