Java 2EE and XML Development

Скачать в pdf «Java 2EE and XML Development»


The Business Delegate pattern is demonstrated by the JAXM examples in chapter 4, which use it to shield application components from the complexities of interacting with remote applications via SOAP.

A.2.3 The Value Object pattern


The Value Object pattern is a simple but very useful pattern in J2EE. A value object is a serializable representation of a complex set of data suitable for passing between application tiers via RMI. Value objects are generally utility classes, similar to structs in C, but can contain behavior to validate or prohibit internal data modification as well. An example of this pattern is creating an Orderlnfo object that contains all the data about a given order. This object could be serialized across the network and used to display information to the user. This is depicted in figure A.7.


Value objects are critical to the proper operation of an RMI-based component model such as EJB. Since local references to remote data are not possible, a snapshot of the data is passed by value to the remote client. Value objects are employed very often. See the case study for a detailed example of their use with XML structures.


There are two other J2EE patterns used with value objects. For completeness, we mention them here. The Value Object Assembler is a pattern for




composing complicated value objects from various other objects. The Value List Handler is a pattern for creating, manipulating, and updating sets of value objects at the same time. The details of these patterns are available at Sun’s J2EE patterns web site.

Скачать в pdf «Java 2EE and XML Development»