Writing Beans (Advanced)Writing DynaBeansA DynaBean is a pseudo-bean whose properties may differ between instances of the same Class. Pseudo-introspection of the available properties uses a pseudo-class of type DynaClass. For more details see BeanUtils.
Betwixt now supports the (correct) writing of objects implementing DynaBean. Rather than using standard
introspection for these objects, Writing Entity Beans
Entity beans are a kind of Enterprise Java Bean. For more details see the
J2EE specification. They are a common way to persist data.
When dealing with an entity bean, you usually deal with the remote interface rather than the
concrete implementation. There is no guarantee that the class presented by the container will be
the class your created to provide the bean's functionality.
Indeed, This causes some difficulties for Betwixt. Betwixt (by default) will introspect the actual implementation presented by the container. Fortunately, the normalization mechanism described here can be used to allow betwixt to introspect the actual interface (rather than the implementation).
There are two different strategies that can be used. The first is to create a special
Of course, this will only work if your J2EE implementation uses
The alternative is to use a
Suppressing The Expression Of AttributesSometimes there are certain values for some attributes which should result in the attribute not being expressed at all. A typical use case is the requirement for null property values to result in the absence of the mapped attributes (as opposed to their expression with an empty value).
Betwixt allows this behaviour to be customized through the setting of the
By default, Betwixt suppresses empty attributes. |