APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.beans.decoder

pack-priv final Class ArrayElementHandler

extends NewElementHandler
Class Inheritance
Imports
java.lang.reflect.Array

This class is intended to handle <array> element, that is used to array creation. The 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:

length
the array length
class
the type of object for instantiation
id
the identifier of the variable that is intended to store the result
Author
Sergey A. Malenkov
Since
1.7

Field Summary

Modifier and TypeField and Description
private Integer

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
addAttribute(String
the attribute name
name
,
String
the attribute value
value
)

Overrides com.sun.beans.decoder.NewElementHandler.addAttribute.

Parses attributes of the element.

protected ValueObject

Returns:

the value of this element
getValueObject
(Class<?>
the base class
type
,
Object[]
the array of arguments
args
)

Overrides com.sun.beans.decoder.NewElementHandler.getValueObject.

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 otherwise
isArgument
()

Overrides com.sun.beans.decoder.ElementHandler.isArgument.

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.sun.beans.decoder.ElementHandler.startElement.

Calculates the value of this element if the length attribute is set.

Inherited from com.sun.beans.decoder.NewElementHandler:
addArgumentgetArgumentsgetArgumentTypesgetContextBeangetValueObject

Field Detail

lengthback to summary
private Integer length

Constructor Detail

ArrayElementHandlerback to summary
pack-priv ArrayElementHandler()

Method Detail

addAttributeback to summary
public void addAttribute(String name, String value)

Overrides com.sun.beans.decoder.NewElementHandler.addAttribute.

Parses attributes of the element. The following attributes are supported:

length
the array length
class
the type of object for instantiation
id
the identifier of the variable that is intended to store the result
Parameters
name:String

the attribute name

value:String

the attribute value

Annotations
@Override
getValueObjectback to summary
protected ValueObject getValueObject(Class<?> type, Object[] args)

Overrides com.sun.beans.decoder.NewElementHandler.getValueObject.

Creates an instance of the array.

Parameters
type:Class<?>

the base class

args:Object[]

the array of arguments

Returns:ValueObject

the value of this element

Annotations
@Override
isArgumentback to summary
protected boolean isArgument()

Overrides com.sun.beans.decoder.ElementHandler.isArgument.

Tests whether the value of this element can be used as an argument of the element that contained in this one.

Returns:boolean

true if the value of this element can be used as an argument of the element that contained in this one, false otherwise

Annotations
@Override
startElementback to summary
public void startElement()

Overrides com.sun.beans.decoder.ElementHandler.startElement.

Calculates the value of this element if the length attribute is set.

Annotations
@Override