net.sf.beanlib.hibernate3
Class LazyHibernateCustomBeanTransformer
java.lang.Object
net.sf.beanlib.hibernate3.LazyHibernateCustomBeanTransformer
- All Implemented Interfaces:
- CustomBeanTransformerSpi, Transformable
public class LazyHibernateCustomBeanTransformer
- extends Object
- implements CustomBeanTransformerSpi
A convenient custom bean transformer that can be used
to replicate only the initialized properties/associations
in a Hibernate object graph.
Sample Usage:
HibernateBeanReplicator replicator = new Hibernate3BeanReplicator();
replicator.initCustomTransformerFactory(new LazyHibernateCustomBeanTransformer.Factory());
replicator.deepCopy(...);
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LazyHibernateCustomBeanTransformer
public LazyHibernateCustomBeanTransformer()
isTransformable
public boolean isTransformable(Object from,
Class<?> toClass,
PropertyInfo propertyInfo)
- Description copied from interface:
CustomBeanTransformerSpi
- Returns true if the given object is to be transformed by this transformer;
false otherwise.
- Specified by:
isTransformable
in interface CustomBeanTransformerSpi
- Parameters:
from
- source objecttoClass
- target classpropertyInfo
- 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.
transform
public <T> T transform(Object in,
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
- Parameters:
in
- 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.