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:
net.sf.beanlib.spi.BeanPopulatorBaseSpi, net.sf.beanlib.spi.BeanTransformerSpi, net.sf.beanlib.spi.Transformable

public class Hibernate3BeanTransformer
extends net.sf.beanlib.provider.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
net.sf.beanlib.spi.BeanTransformerSpi.Factory
 
Field Summary
 
Fields inherited from class net.sf.beanlib.provider.replicator.ReplicatorTemplate
log
 
Constructor Summary
Hibernate3BeanTransformer()
           
Hibernate3BeanTransformer(net.sf.beanlib.spi.BeanPopulatorSpi.Factory beanPopulatorFactory)
           
 
Method Summary
protected
<T> T
createToInstance(java.lang.Object from, java.lang.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
replicate(T from)
          Replicate the given from object, recursively if necessary.
 
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, 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(net.sf.beanlib.spi.BeanPopulatorSpi.Factory beanPopulatorFactory)
Method Detail

createToInstance

protected <T> T createToInstance(java.lang.Object from,
                                 java.lang.Class<T> toClass)
                      throws java.lang.InstantiationException,
                             java.lang.IllegalAccessException,
                             java.lang.SecurityException,
                             java.lang.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 net.sf.beanlib.provider.replicator.ReplicatorTemplate
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.SecurityException
java.lang.NoSuchMethodException

replicate

protected <T> T replicate(T from)
Replicate the given from object, recursively if necessary. Currently a property is replicated if it is an instance of Collection, Map, Timestamp, Date, Blob, Hibernate entity, JavaBean, or an array.

Overrides:
replicate in class net.sf.beanlib.provider.replicator.ReplicatorTemplate


Copyright © 2009. All Rights Reserved.