DPML
DPML Metro: Entry Directive
HomeUtilitiesStationMetro
Entry Directive
Description

Declaration of the binding of a context key with a value established by reference or in-line construction.

Entry Attributes (Common)
key The entry key (required). If a context interface declares a method such as getTotalWidth() the key value will be totalWidth. (refer java.beans.Introspector#decapitalize for additional details concerning method to key transformation).
Entry Attributes (for non-array entries)
class Optional declaration of a classname to be instantiated using any enclosed values. Classnames may include any class within the scope of the component classloader or any primitive datatype. The 'class' attribue not be used in in conjunction with the lookup attribute.
method Optional declaration of the method to invoke on the target object established by the class attribute. The default method value is the keyword new used within bean expression construction. If the method name references a static field the filed value will be used to establish the target object. May not be used in in conjunction with the lookup attribute.
value Optional declaration of string value used as a constructor or operation argument. May not be used in in conjunction with the lookup attribute or value attribute.
lookup Requested service interface classname. For exmple, the the lookup="org.acme.Widget" is an instruction to the container to resolve a service instance type assignable to the Widget interface. May not be used in conjunction with the class, method, or value attributes or nested values.
Nested Elements
param The entry element may contain 0..n nested <param> directives. A param directive allows in-line construction of operation parameters, array entries, or constructor arguments. Nested params may not be used in conjunction with the entry lookup or value attributes.
Example
Static Field Example

Example of the creation of a context entry referencing a static method. In the following example a value is constructed using a static field RED on the class java.awt.Color. The class java.awt.Color is selected by default because no class attribute is declared therefore the class defaults to the class declared as a return type in the component context getColor method.

<entry key="color" method="RED"/>
Constructed Example

The following example constructs a java.awt.Color instance by creating a series of primitive constructor arguments, instantiating a new color instance and assigning this under the context entry key.

<entry key="color">
  <param class="float" value="100"/>
  <param class="float" value="200"/>
  <param class="float" value="0"/>
</entry>

The following example constructs an instance of java.io.File using a symbolic argument as a constructor parameter value (the example assumes that the return type declared by the context entry is of the type java.io.File). Any system or Transit property may be used as a symbolic argument.

<entry key="dir" value="${user.dir}/working">

The following example constructs an String array (assuming that the underlying context entry declares a String[] return type).

<entry key="names">
  <param value="Hello"/>
  <param value="World"/>
</entry>