C H A P T E R  31

Object Adapter Model

The Object Adapter Model provides access to any object's, or any of its contained objects', fields, bean properties, and/or methods using path expressions that specify deep access to object members.

After the Object Class Name property has been set for the model, and if that class is compiled and loadable, the general keypath binding chooser is available for browsing, or for use when binding to display fields on views. Although views may bind to anonymous path expressions, the developer may also create named model fields that act as aliases to complex path expressions to help isolate changes in the object graph from clients of the model. This can be done manually after adding a model field and setting the model field properties, or automatically by invoking the Browse/Add Object Field Bindings action.

This component implements com.iplanet.jato.model.ExecutingModel, and may have model operations declared in the IDE. These model operations are mapped to the top-level methods on the adapted object class, and only these methods may be exposed as model operations. Although path expressions may invoke a deep method in the object graph, the current implementation only supports methods with zero parameters or string literal parameters. Model operations may be created manually by adding a new model operation and editing the property sheet for the operation name and parameters. Operations may be automatically added using the contextual menu choice Complete Missing Operations.

Property Name

Description

Notes

Default Dataset Name

Because there may be more than one dataset (collection) in the adapted object, this property declares which of these datasets will be considered the default. During field binding, any path expression which cross a contained dataset requires a current dataset name to be set for the model. This property allows the developer to specify a dataset name (path expression denoting a contained dataset) which the model will use in the case of a null current dataset name.

 

Is Object Array

When true, indicates that the object type being adapted is an array or collection. Default setting is false.

 

Name

The class name of the component.

Req

Object Class Name

The fully qualified class name of the object type being adapted.

Req

Object Factory

Allows the developer to specify a JavaBean implementing the ObjectFactory interface. When the adapted object is not set programmatically and an object factory is specified instead, the model will delegate to the object factory to find the adapted object at runtime. The standard object factories allow objects to be retrieved from the standard J2EE request, session, or application scopes.

 


Object Adapter Model Design Actions

Complete Missing Operations

Invoking this action will ensure that there are at least a set of model operations representative of the top-level public methods on the adapted object. Please refer to the detailed JavaDocs which describe the storage mechanism for model operations parameters and return values.

Browse/Add Object Field Bindings

Invoking this action opens the binding chooser dialog and allows the developer to explore properties and operations of the object (properties are only available if the object is a JavaBean, and operations are only available if operations have been defined for top-level object methods). The dialog displays the key path expression for the currently selected node in the object graph. Nodes in the object graph which represent datasets have path expressions highlighted and denoted as dataset names. Selecting OK will generate a new model field for the currently selected node in the graph. Selecting Cancel will exit the dialog without adding a field. Developers may also highlight the current path expression and copy it to the clipboard. This capability is useful when setting the Default Dataset Name property, or the Primary Dataset Name property of a TiledView.

Fields

Property Name

Description

Notes

Key Path

An expression describing how to traverse properties, members, and methods on the adapted object graph to arrive at the field's value. This expression will be used at runtime to resolve a logical field name to a physical field value in the object graph. Please refer to the JavaDocs for detailed explanation of the key path expression syntax.

 

Name

The logical name of the model field.

Req


Operations

Property Name

Description

Notes

Name

The model operation name.

Req

Operation Name

The name of the public method on the adapted object class.

Req

Operation Parameter

Describes zero or more parameters for the method of this operation.