length attribute specifies the length of the array.
The class attribute specifies the elements type.
The Object type is used by default.
For example:<array length="10"/>is equivalent to
new Component[10] in Java code.
The set and get methods,
as defined in the java.util.List interface,
can be used as if they could be applied to array instances.
The index attribute can thus be used with arrays.
For example:
<array length="3" class="java.lang.String">
<void index="1">
<string>Hello, world</string>
</void>
</array>
is equivalent to the following Java code:String[] s = new String[3]; s[1] = "Hello, world";It is possible to omit the
length attribute and
specify the values directly, without using void tags.
The length of the array is equal to the number of values specified.
For example:
<array id="array" class="int">
<int>123</int>
<int>456</int>
</array>
is equivalent to int[] array = {123, 456} in Java code.
The following attributes are supported:
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | addAttribute(String
the attribute name name, String the attribute value value)Overrides com. Parses attributes of the element. |
| protected ValueObject | Returns: the value of this elementthe base class type, Object[] the array of arguments args)Overrides com. Creates an instance of the array. |
| protected boolean | Returns: true if the value of this element can be used
as an argument of the element that contained in this one,
false otherwiseOverrides com. Tests whether the value of this element can be used as an argument of the element that contained in this one. |
| public void | startElement()
Overrides com. Calculates the value of this element if the length attribute is set. |
| length | back to summary |
|---|---|
| private Integer length | |
| ArrayElementHandler | back to summary |
|---|---|
| pack-priv ArrayElementHandler() | |
| addAttribute | back to summary |
|---|---|
| public void addAttribute(String name, String value) Overrides com. Parses attributes of the element. The following attributes are supported:
| |
| getValueObject | back to summary |
|---|---|
| protected ValueObject getValueObject(Class<?> type, Object[] args) Overrides com. Creates an instance of the array.
| |
| isArgument | back to summary |
|---|---|
| protected boolean isArgument() Overrides com. Tests whether the value of this element can be used as an argument of the element that contained in this one.
| |
| startElement | back to summary |
|---|---|
| public void startElement() Overrides com. Calculates the value of this element if the length attribute is set.
| |