I think that the additivity of the two behaviours could be got with
the next change on BeanTransformer:
@Override
public final <T> T transform(Object from, Class<T> toClass,
PropertyInfo propertyInfo)
{
try {
T replica = replicate(fromReplication, toClass);
if (customTransformer.isTransformable(from, toClass,
propertyInfo))
return customTransformer.transform(replica, toClass,
propertyInfo);
else
return replica;
} catch (SecurityException e) {
throw new BeanlibException(e);
}
}
Additionally, if the coder just want to use the customTransformer,
without the Hibernate3BeanTransformer, he/she can set up the
HibernatePropertyFilter to exclude the javabean from the replication
process.
On May 31, 5:33 pm, Hanson Char <
hanson.c...@gmail.com> wrote:
> It seems CustomBeanTransformerSpi is the extension point you are looking for.
>
> The intent of CustomBeanTransformerSpi instance is to alter the
> transformation behavior - it doesn't replace Hibernate3BeanTransformer
> unless you choose to always return true from your provided
> CustomBeanTransformerSpi.isTransformable() method.
>
> There also exists a convenient ChainedCustomBeanTransformer.java that
> makes it easier to "combine" multiple custom transformers:
>
>
http://beanlib.sourceforge.net/5.0.5/api/net/sf/beanlib/spi/ChainedCu...
>
> More general info:
>
>
http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-doc/f...
>
> Hope this helps.
>
> Regards,
> Hanson
>
>
>
> On Thu, May 31, 2012 at 7:34 AM, Luis <
luch...@gmail.com> wrote:
> > Hi.
>
> > First of all, I'd like to thank you for your library. It's very
> > useful.
>
> > I've been playing with it, trying to copy a Hiberanate object,
> > ignoring some properties of the beans and resetting some values to a
> > concrete value. using the HibernateBeanReplicator.
>
> > While the copy and the use of the HibernatePropertyFilter are working
> > properly, I'm trying to set certains properties of the bean, and all
> > the beans included, recursively, without success.
>
> > Is there any extension point in the library that lets me set values to
> > certains properties of all the beans copied during the copy process?
>
> > I've tried with a CustomBeanTransformerSpi transformer, where I set
> > the values, but that doesn't seem to be the purpose of that class, as
> > I don't want a replacment of Hibernate3BeanTransformer but an
> > extension, and I want to run the sets over all the copied beans, not
> > only the first level bean.
>
> > Thaks in advance.- Hide quoted text -
>
> - Show quoted text -