|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.beanlib.hibernate.HibernateBeanReplicator
@NotThreadSafe public abstract class HibernateBeanReplicator
Hibernate Bean Replicator.
This class can be used to conveniently replicate Hibernate 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
BeanPopulatorBaseSpi are available, as
the replication of JavaBean properties inevitably involves bean population.
HibernatePropertyFilter is used,
vetoer used to veto the propagation of a property
initCustomTransformerFactory(net.sf.beanlib.spi.CustomBeanTransformerSpi.Factory...).
This was originally the base class for both the Hibernate 2.x and Hibernate 3.x replicators, but now Hibernate 2 is no longer supported.
CustomBeanTransformerSpi,
Hibernate3BeanReplicator| Constructor Summary | |
|---|---|
protected |
HibernateBeanReplicator(net.sf.beanlib.spi.BeanTransformerSpi hibernateBeanTransformer)
You probably want to construct a Hibernate3BeanReplicator
directly instead of this ? |
| Method Summary | ||
|---|---|---|
|
copy(java.lang.Object from,
java.lang.Class<T> toClass)
Returns an instance of the given class with values copied from the given object. |
|
|
copy(T from)
Returns a copy of the given object. |
|
|
deepCopy(java.lang.Object from,
java.lang.Class<T> toClass)
Convenient method to deep copy the given object to an instance of the given class using the default behavior. |
|
|
deepCopy(T from)
Convenient method to deep copy the given object using the default behavior. |
|
net.sf.beanlib.spi.BeanPopulationExceptionHandler |
getBeanPopulationExceptionHandler()
|
|
net.sf.beanlib.spi.BeanPopulatorBaseConfig |
getBeanPopulatorBaseConfig()
Notes if the returned base config is modified, a subsequent BeanPopulator.initBeanPopulatorBaseConfig(BeanPopulatorBaseConfig)
needs to be invoked to keep the configuration in sync. |
|
net.sf.beanlib.spi.BeanSourceHandler |
getBeanSourceHandler()
|
|
net.sf.beanlib.spi.DetailedPropertyFilter |
getDetailedPropertyFilter()
|
|
HibernatePropertyFilter |
getHibernatePropertyFilter()
Convenient method to return the current property filter as HibernatePropertyFilter if the type matches; or null otherwise. |
|
net.sf.beanlib.spi.PropertyFilter |
getPropertyFilter()
Returns the property filter that is used to control what properties get propagated across and what get skipped. |
|
net.sf.beanlib.spi.BeanMethodFinder |
getReaderMethodFinder()
|
|
net.sf.beanlib.spi.BeanMethodCollector |
getSetterMethodCollector()
|
|
HibernateBeanReplicator |
initBeanPopulationExceptionHandler(net.sf.beanlib.spi.BeanPopulationExceptionHandler beanPopulationExceptionHandler)
|
|
net.sf.beanlib.spi.BeanPopulatorBaseSpi |
initBeanPopulatorBaseConfig(net.sf.beanlib.spi.BeanPopulatorBaseConfig baseConfig)
Used to conveniently provide the bean population related configuration options as a single configuration object. |
|
HibernateBeanReplicator |
initBeanSourceHandler(net.sf.beanlib.spi.BeanSourceHandler beanSourceHandler)
Used to configure a call-back (to produce whatever side-effects deemed necessary) that is invoked after the property value has been retrieved from the source bean, but before being propagated across to the target bean. |
|
HibernateBeanReplicator |
initCustomTransformerFactory(net.sf.beanlib.spi.CustomBeanTransformerSpi.Factory... customBeanTransformerFactories)
Initializes with one or more custom bean transformer factories that will be chained together. |
|
HibernateBeanReplicator |
initDebug(boolean debug)
Used to control whether debug messages should be logged. |
|
HibernateBeanReplicator |
initDetailedPropertyFilter(net.sf.beanlib.spi.DetailedPropertyFilter detailedPropertyFilter)
Note this method is only applicable if either the copy(Object)
or copy(Object, Class) is directly invoked,
and is ignored otherwise (ie ignored if deep or shallow copy is invoked instead). |
|
HibernateBeanReplicator |
initPropertyFilter(net.sf.beanlib.spi.PropertyFilter propertyFilter)
Note this method is only applicable if either the copy(Object)
or copy(Object, Class) is directly invoked,
and is ignored otherwise (ie ignored if deep or shallow copy is invoked instead). |
|
HibernateBeanReplicator |
initReaderMethodFinder(net.sf.beanlib.spi.BeanMethodFinder readerMethodFinder)
Used to configure a finder to find the property getter methods of a source JavaBean. |
|
HibernateBeanReplicator |
initSetterMethodCollector(net.sf.beanlib.spi.BeanMethodCollector setterMethodCollector)
Used to configure a collector to collect the property setter methods of a target JavaBean. |
|
boolean |
isDebug()
|
|
|
shallowCopy(java.lang.Object from,
java.lang.Class<T> toClass)
Convenient method to shallow copy the given object to an instance of the given class using the default behavior. |
|
|
shallowCopy(T from)
Convenient method to shallow copy the given object using the default behavior. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected HibernateBeanReplicator(net.sf.beanlib.spi.BeanTransformerSpi hibernateBeanTransformer)
Hibernate3BeanReplicator
directly instead of this ?
| Method Detail |
|---|
public final <T> T copy(T from)
In the case when none of the init* methods is invoked, this method behaves
like deepCopy(Object), but without using the HibernatePropertyFilter.
T - type of the given object.from - given object.
public final <T> T copy(java.lang.Object from,
java.lang.Class<T> toClass)
In the case when none of the init* methods is invoked, this method behaves
exactly like deepCopy(Object, Class).
T - type of the given object.from - given object.toClass - target class of the returned object.public final <T> T deepCopy(T from)
Notes:
copy(Object, Class) instead of this method
if you want to plug in a different (detailed) property filter.
T - from object type.from - given object to be copied.
public final <T> T deepCopy(java.lang.Object from,
java.lang.Class<T> toClass)
Notes:
copy(Object, Class) instead of this method
if you want to plug in a different (detailed) property filter.
T - to object type.from - given object to be copied.toClass - target class of the returned object.
public final <T> T shallowCopy(T from)
Notes:
copy(Object, Class) instead of this method
if you want to plug in a different (detailed) property filter.
T - from object type.from - given object to be copied.
HibernatePropertyFilter
public final <T> T shallowCopy(java.lang.Object from,
java.lang.Class<T> toClass)
Notes:
copy(Object, Class) instead of this method
if you want to plug in a different (detailed) property filter.
T - to object type.from - given object to be copied.
public final HibernateBeanReplicator initCustomTransformerFactory(net.sf.beanlib.spi.CustomBeanTransformerSpi.Factory... customBeanTransformerFactories)
ChainedCustomBeanTransformerpublic final net.sf.beanlib.spi.PropertyFilter getPropertyFilter()
getPropertyFilter in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic final HibernateBeanReplicator initPropertyFilter(net.sf.beanlib.spi.PropertyFilter propertyFilter)
copy(Object)
or copy(Object, Class) is directly invoked,
and is ignored otherwise (ie ignored if deep or shallow copy is invoked instead).
initPropertyFilter in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipropertyFilter - is similar to DetailedPropertyFilter but with a simpler API
that is used to control whether a specific JavaBean property should be propagated
from a source bean to a target bean.
public final HibernateBeanReplicator initDetailedPropertyFilter(net.sf.beanlib.spi.DetailedPropertyFilter detailedPropertyFilter)
copy(Object)
or copy(Object, Class) is directly invoked,
and is ignored otherwise (ie ignored if deep or shallow copy is invoked instead).
initDetailedPropertyFilter in interface net.sf.beanlib.spi.BeanPopulatorBaseSpidetailedPropertyFilter - is used to control whether a specific JavaBean property
should be propagated from the source bean to the target bean.
public final HibernateBeanReplicator initBeanSourceHandler(net.sf.beanlib.spi.BeanSourceHandler beanSourceHandler)
initBeanSourceHandler in interface net.sf.beanlib.spi.BeanPopulatorBaseSpibeanSourceHandler - can be used to act as a call-back
(to produce whatever side-effects deemed necessary)
after the property value has been retrieved from the source bean,
but before being propagated across to the target bean.
public final HibernateBeanReplicator initDebug(boolean debug)
initDebug in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic final HibernateBeanReplicator initReaderMethodFinder(net.sf.beanlib.spi.BeanMethodFinder readerMethodFinder)
initReaderMethodFinder in interface net.sf.beanlib.spi.BeanPopulatorBaseSpireaderMethodFinder - can be used to find the property getter methods of a source JavaBean.
public final HibernateBeanReplicator initSetterMethodCollector(net.sf.beanlib.spi.BeanMethodCollector setterMethodCollector)
initSetterMethodCollector in interface net.sf.beanlib.spi.BeanPopulatorBaseSpisetterMethodCollector - can be used to collect the property setter methods
of a target JavaBean.
public HibernateBeanReplicator initBeanPopulationExceptionHandler(net.sf.beanlib.spi.BeanPopulationExceptionHandler beanPopulationExceptionHandler)
initBeanPopulationExceptionHandler in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic net.sf.beanlib.spi.BeanPopulatorBaseSpi initBeanPopulatorBaseConfig(net.sf.beanlib.spi.BeanPopulatorBaseConfig baseConfig)
initBeanPopulatorBaseConfig in interface net.sf.beanlib.spi.BeanPopulatorBaseSpibaseConfig - is used to conveniently group all the other initializable options into a single unit.
public net.sf.beanlib.spi.BeanPopulationExceptionHandler getBeanPopulationExceptionHandler()
getBeanPopulationExceptionHandler in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic net.sf.beanlib.spi.BeanPopulatorBaseConfig getBeanPopulatorBaseConfig()
BeanPopulator.initBeanPopulatorBaseConfig(BeanPopulatorBaseConfig)
needs to be invoked to keep the configuration in sync.
getBeanPopulatorBaseConfig in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic net.sf.beanlib.spi.BeanSourceHandler getBeanSourceHandler()
getBeanSourceHandler in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic boolean isDebug()
isDebug in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic net.sf.beanlib.spi.DetailedPropertyFilter getDetailedPropertyFilter()
getDetailedPropertyFilter in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic net.sf.beanlib.spi.BeanMethodFinder getReaderMethodFinder()
getReaderMethodFinder in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic net.sf.beanlib.spi.BeanMethodCollector getSetterMethodCollector()
getSetterMethodCollector in interface net.sf.beanlib.spi.BeanPopulatorBaseSpipublic HibernatePropertyFilter getHibernatePropertyFilter()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||