net.sf.beanlib.hibernate3
Class Hibernate3BeanTransformer

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

public class Hibernate3BeanTransformer
extends BeanTransformer

A Hibernate 3 Bean Transformer is simply a BeanTransformer with the extended capabilities of handling Hibernate (v3.x) objects. By default, the Hibernate proxies are replaced with the actual instances, eagerly fetching from the database as necessary. However, the exact behavior of the transformation process, including whether eager fetching is enabled or not, can be controlled using the same SPI as BeanTransformer.

Author:
Joe D. Velopar
See Also:
BeanTransformer, Hibernate3BeanReplicator

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.beanlib.spi.BeanTransformerSpi
BeanTransformerSpi.Factory
 
Field Summary
 
Fields inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
log
 
Constructor Summary
Hibernate3BeanTransformer()
           
Hibernate3BeanTransformer(BeanPopulatorSpi.Factory beanPopulatorFactory)
           
 
Method Summary
protected
<T> T
createToInstance(Object from, Class<T> toClass)
          Creates a target instance from either the class of the given "from" object or the given toClass, giving priority to the one which is more specific whenever possible.
protected
<T> T
unenhanceObject(T from)
          Returns an equivalent object un-enhanced from the given object.
 
Methods inherited from class net.sf.beanlib.provider.BeanTransformer
getArrayReplicatable, getBeanPopulationExceptionHandler, getBeanPopulatorBaseConfig, getBeanPopulatorSpiFactory, getBeanReplicatable, getBeanSourceHandler, getBlobReplicatable, getCalendarReplicatable, getClonedMap, getCollectionReplicatable, getCustomBeanTransformer, getDateReplicatable, getDetailedPropertyFilter, getImmutableReplicatable, getMapReplicatable, getPropertyFilter, getReaderMethodFinder, getSetterMethodCollector, initArrayReplicatableFactory, initBeanPopulationExceptionHandler, initBeanPopulatorBaseConfig, initBeanReplicatableFactory, initBeanSourceHandler, initBlobReplicatableFactory, initCalendarReplicatableFactory, initCollectionReplicatableFactory, initCustomTransformerFactory, initDateReplicatableFactory, initDebug, initDetailedPropertyFilter, initImmutableReplicatableFactory, initMapReplicatableFactory, initPropertyFilter, initReaderMethodFinder, initSetterMethodCollector, isDebug, reset, transform
 
Methods inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
chooseClass, containsTargetCloned, createToInstance, createToInstanceWithComparator, getCustomerBeanTransformer, 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
 

Constructor Detail

Hibernate3BeanTransformer

public Hibernate3BeanTransformer()

Hibernate3BeanTransformer

public Hibernate3BeanTransformer(BeanPopulatorSpi.Factory beanPopulatorFactory)
Method Detail

createToInstance

protected <T> T createToInstance(Object from,
                                 Class<T> toClass)
                      throws InstantiationException,
                             IllegalAccessException,
                             SecurityException,
                             NoSuchMethodException
Creates a target instance from either the class of the given "from" object or the given toClass, giving priority to the one which is more specific whenever possible. Note the class of the given from object is un-enhanced if it is found to be an enhanced object either via cglib or javassist.

Overrides:
createToInstance in class ReplicatorTemplate
Throws:
InstantiationException
IllegalAccessException
SecurityException
NoSuchMethodException

unenhanceObject

protected final <T> T unenhanceObject(T from)
Description copied from class: ReplicatorTemplate
Returns an equivalent object un-enhanced from the given object. By default, the input object is returned. Subclass must override this method to perform any such un-enhancement, if necessary.

Overrides:
unenhanceObject in class ReplicatorTemplate