The <array>
element can be used to construct an array of any supported datatype.
As well as arbitrary datatypes, you can make arrays of primitive and simple types such as int
, java.lang.Long
, and java.lang.String
. Arrays can also be copied from other arrays. The <array>
element requires that the fully-qualified class name of the array type be specified. The array to copy, array length, or array elements can also be provided during array construction. If none are provided, a zero-length array will be created. If an array to copy and an array length are both specified, then the created array will have a length that is the greater of the length of the array being copied and the specified length.
Array elements are evaluated and assigned to array indexes in the order they are declared. Individual array element values can be specified using either the element attribute or a nested element. The element attribute may contain the special value null
to indicate an array element with no value. Nested elements may also be compound datatypes. Variables can also be used as the source of element values.
The array creation can fail and produce no result if:
|
Below are examples of creating a primitive type array, a multi-dimensional Calling Party Number array, and copying an array.
Primitive Type Array
You can construct an array of primitive types (such as int
) like this:
<array class="int[]">
<element value="0"/>
<element value="1"/>
<element value="${user.int-value-1}"/>
<element value="7"/>
<element value="${user.int-value-2}"/>
</array>
Multi-Dimensional Array
Below is a (contrived) example of how a three-dimensional CallingPartyNumber
array could be created and populated with various values:
<array class="com.opencloud.slee.resources.in.datatypes.cc.CallingPartyNumber[][][]" length="${user.some-length]}">
<element>
<array class="com.opencloud.slee.resources.in.datatypes.cc.CallingPartyNumber[][]">
<element>
<array class="com.opencloud.slee.resources.in.datatypes.cc.CallingPartyNumber[]">
<element>
<!-- concrete value specified using pre-defined datatype constructor -->
<calling-party-number
nature="NATIONAL"
number-incomplete="false"
numbering-plan="ISDN"
presentation="ALLOWED"
screening="NETWORK_PROVIDED"
address="12345"/>
</element>
<!-- an empty element -->
<element value="null"/>
<element>
<!-- concrete value specified using generic object constructor -->
<object class="com.opencloud.slee.resources.in.datatypes.cc.CallingPartyNumber">
<field name="nature" value="INTERNATIONAL"/>
<field name="number-incomplete" value="true"/>
<field name="numbering-plan" value="ISDN"/>
<field name="presentation" value="ALLOWED"/>
<field name="screening" value="NETWORK_PROVIDED"/>
<field name="address" value="999887"/>
</object>
</element>
<!-- element value from a variable -->
<element value="${initial-dp.arg.calling-party-number}"/>
</array>
</element>
</array>
</element>
<element>
<!-- an array with a specified length, but no elements defined -->
<array class="com.opencloud.slee.resources.in.datatypes.cc.CallingPartyNumber[][]" length="1"/>
</element>
</array>
Copying an Array
The following example makes a copy of the genericNumbers field in a Connect operation argument:
<array class="com.opencloud.slee.resources.in.datatypes.cc.GenericNumber[]" copy-of="${connect.arg.generic-numbers}"/>