net.sf.beanlib.hibernate3
Class Hibernate3BeanReplicator

java.lang.Object
  extended by net.sf.beanlib.hibernate.HibernateBeanReplicator
      extended by net.sf.beanlib.hibernate3.Hibernate3BeanReplicator
All Implemented Interfaces:
BeanPopulatorBaseSpi

@NotThreadSafe
public class Hibernate3BeanReplicator
extends HibernateBeanReplicator

Hibernate 3 Bean Replicator.

This class can be used to conveniently replicate Hibernate (v3.x) objects that follow the JavaBean getter/setter convention on a best attempt basis. The replication is typically recursive in that the whole object graph of the input object is replicated into an equivalent output object graph, resolving circular references, and eagerly fetching proxied instances as necessary. However, the exact behavior of the replication process including

can be controlled and/or supplemented by the client code via various options:

  1. All the configurable options of BeanPopulatorBaseSpi are available, as the replication of JavaBean properties inevitably involves bean population.
  2. Specifying an application package prefix: property with a type of an entity bean class with package name that matchs the prefix will be replicated;
  3. Specifying a set of entity bean classes: property with a type of an entity bean class that is part of the set will be replicated;
  4. Specifying a set of collection and map properties that will be replicated;
  5. Specifying a vetoer used to veto the propagation of a property
  6. For anything else that the existing implementation fails to transform, client can provide one or multiple custom transformer factories via HibernateBeanReplicator.initCustomTransformerFactory(net.sf.beanlib.spi.CustomBeanTransformerSpi.Factory...).

Author:
Joe D. Velopar
See Also:
CustomBeanTransformerSpi, HibernateBeanReplicator

Constructor Summary
Hibernate3BeanReplicator()
          By default, all properties will be included for replication.
Hibernate3BeanReplicator(Set<Class<?>> entityBeanClassSet, Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet, PropertyFilter vetoer)
          Convenient constructor to specify: The set of entity bean classes for matching properties that will be replicated; The set of collection and map properties that will be replicated; A vetoer used to veto the propagation of specific properties
Hibernate3BeanReplicator(String applicationPackagePrefix)
          Constructs with an application package prefix.
Hibernate3BeanReplicator(String applicationPackagePrefix, Set<Class<?>> entityBeanClassSet, Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet, PropertyFilter vetoer)
          Convenient constructor to specify: An application package prefix used to determine if a property with a type of an entity bean class will be included for replication; The set of entity bean classes for matching properties that will be replicated; The set of collection and map properties that will be replicated; A vetoer used to veto the propagation of specific properties
 
Method Summary
 
Methods inherited from class net.sf.beanlib.hibernate.HibernateBeanReplicator
copy, copy, deepCopy, deepCopy, getBeanPopulationExceptionHandler, getBeanPopulatorBaseConfig, getBeanSourceHandler, getDetailedPropertyFilter, getHibernatePropertyFilter, getPropertyFilter, getReaderMethodFinder, getSetterMethodCollector, initBeanPopulationExceptionHandler, initBeanPopulatorBaseConfig, initBeanSourceHandler, initCustomTransformerFactory, initDebug, initDetailedPropertyFilter, initPropertyFilter, initReaderMethodFinder, initSetterMethodCollector, isDebug, shallowCopy, shallowCopy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hibernate3BeanReplicator

public Hibernate3BeanReplicator()
By default, all properties will be included for replication.


Hibernate3BeanReplicator

public Hibernate3BeanReplicator(String applicationPackagePrefix)
Constructs with an application package prefix.

Parameters:
applicationPackagePrefix - An application package prefix used to determine if a property with a type of an entity bean class will be included for replication.

Hibernate3BeanReplicator

public Hibernate3BeanReplicator(Set<Class<?>> entityBeanClassSet,
                                Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet,
                                PropertyFilter vetoer)
Convenient constructor to specify:
  1. The set of entity bean classes for matching properties that will be replicated;
  2. The set of collection and map properties that will be replicated;
  3. A vetoer used to veto the propagation of specific properties

Note this constructor is relevant only if the default property filter HibernatePropertyFilter is used.

Parameters:
entityBeanClassSet - The set of entity bean classes for matching properties that will be replicated, eagerly fetching if necessary. Null means all whereas empty means none.
collectionPropertyNameSet - The set of collection and map properties that will be replicated, eagerly fetching if necessary. Null means all whereas empty means none.
vetoer - used to veto the propagation of specific properties.

Hibernate3BeanReplicator

public Hibernate3BeanReplicator(String applicationPackagePrefix,
                                Set<Class<?>> entityBeanClassSet,
                                Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet,
                                PropertyFilter vetoer)
Convenient constructor to specify:
  1. An application package prefix used to determine if a property with a type of an entity bean class will be included for replication;
  2. The set of entity bean classes for matching properties that will be replicated;
  3. The set of collection and map properties that will be replicated;
  4. A vetoer used to veto the propagation of specific properties

Note this constructor is relevant only if the default property filter HibernatePropertyFilter is used.

Parameters:
entityBeanClassSet - The set of entity bean classes for matching properties that will be replicated, eagerly fetching if necessary. Null means all whereas empty means none.
collectionPropertyNameSet - The set of collection and map properties that will be replicated, eagerly fetching if necessary. Null means all whereas empty means none.
vetoer - used to veto the propagation of specific properties.