DPML
DPML Metro: Value Directive
HomeUtilitiesStationMetro
Value Directive
Description

In-line construction of an entry or value constructor or invocation argument. In other words - value directives allow for the creation of target objects that can be used as class constructor values or operation arguments to an enclosing value or entry.

Attributes
class Optional declaration of a classname to be instantiated using any enclosed values. The default class value is java.lang.String.
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.
value Optional declaration of string value used as a constructor or operation argument. May not be used in in conjunction with nested value attributes.
Nested Elements
param The value element may contain 0..n nested <value> directives. If the value class is an array class the nested values are interprited as array entries otherwise nested values are interprited as constructor parameter values. Nested values may not be used in conjuntion with the value attribute.
Example
Simple Value Example

Simple java.lang.String value assignment:

<param value="Hello"/>
Static Field Example

Example of the creation of a value referencing a static method. In the following example a value is constructed using a static field BLUE on the class java.awt.Color.

<param class="java.awt.Color" method="RED"/>
Constructor Example

Example of the creation of an instance of java.awt.Color using a set of nested primitive values.

<param class="java.awt.Color">
  <param class="float" value="100"/>
  <param class="float" value="200"/>
  <param class="float" value="0"/>
</param>
Array Example

Example of the creation of an int array. Array datatypes may be declared using the "[]" postfix on the class attribute value. Nested elements will be used to resolve array entry values.

<param class="int[]">
  <param class="int" value="1"/>
  <param class="int" value="2"/>
  <param class="int" value="3"/>
</param>