java.lang.reflect.Array Class Reference

List of all members.


Detailed Description

This class must be implemented by the VM vendor.

This class provides methods to dynamically create and access arrays.

Static Public Member Functions

static native Object get (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index.
static native boolean getBoolean (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to a boolean if possible.
static native byte getByte (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to a byte if possible.
static native char getChar (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to a char if possible.
static native double getDouble (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to a double if possible.
static native float getFloat (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to a float if possible.
static native int getInt (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to an int if possible.
static native int getLength (Object array) throws IllegalArgumentException
 Return the length of the array.
static native long getLong (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to a long if possible.
static native short getShort (Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Return the element of the array at the specified index, converted to a short if possible.
static Object newInstance (Class<?> componentType, int[] dimensions) throws NegativeArraySizeException, IllegalArgumentException
 Return a new multidimensional array of the specified component type and dimensions.
static Object newInstance (Class<?> componentType, int size) throws NegativeArraySizeException
 Return a new array of the specified component type and length.
static native void set (Object array, int index, Object value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the value.
static native void setBoolean (Object array, int index, boolean value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the boolean value.
static native void setByte (Object array, int index, byte value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the byte value.
static native void setChar (Object array, int index, char value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the char value.
static native void setDouble (Object array, int index, double value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the double value.
static native void setFloat (Object array, int index, float value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the float value.
static native void setInt (Object array, int index, int value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the int value.
static native void setLong (Object array, int index, long value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the long value.
static native void setShort (Object array, int index, short value) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
 Set the element of the array at the specified index to the short value.

Private Member Functions

 Array ()
 Prevent this class from being instantiated.

Static Private Member Functions

static native Object multiNewArrayImpl (Class<?> componentType, int dimensions, int[] dimensionsArray)
static native Object newArrayImpl (Class<?> componentType, int dimension)


Constructor & Destructor Documentation

java.lang.reflect.Array.Array (  )  [private]

Prevent this class from being instantiated.


Member Function Documentation

static native Object java.lang.reflect.Array.multiNewArrayImpl ( Class<?>  componentType,
int  dimensions,
int[]  dimensionsArray 
) [static, private]

TODO Document this method. Is it actually used?

Parameters:
componentType 
dimensions 
dimensionsArray 
Returns:

static native Object java.lang.reflect.Array.newArrayImpl ( Class<?>  componentType,
int  dimension 
) [static, private]

TODO Document this method. Is it actually used?

Parameters:
componentType 
dimension 
Returns:

static native Object java.lang.reflect.Array.get ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index.

This reproduces the effect of array[index] If the array component is a base type, the result is automatically wrapped.

Parameters:
array the array
index the index
Returns:
the requested element, possibly wrapped
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native boolean java.lang.reflect.Array.getBoolean ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to a boolean if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native byte java.lang.reflect.Array.getByte ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to a byte if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native char java.lang.reflect.Array.getChar ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to a char if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native double java.lang.reflect.Array.getDouble ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to a double if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native float java.lang.reflect.Array.getFloat ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to a float if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native int java.lang.reflect.Array.getInt ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to an int if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native int java.lang.reflect.Array.getLength ( Object  array  )  throws IllegalArgumentException [static]

Return the length of the array.

This reproduces the effect of array.length

Parameters:
array the array
Returns:
the length
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array

static native long java.lang.reflect.Array.getLong ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to a long if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native short java.lang.reflect.Array.getShort ( Object  array,
int  index 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Return the element of the array at the specified index, converted to a short if possible.

This reproduces the effect of array[index]

Parameters:
array the array
index the index
Returns:
the requested element
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the element cannot be converted to the requested type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static Object java.lang.reflect.Array.newInstance ( Class<?>  componentType,
int[]  dimensions 
) throws NegativeArraySizeException, IllegalArgumentException [static]

Return a new multidimensional array of the specified component type and dimensions.

This reproduces the effect of new componentType[d0][d1]...[dn] for a dimensions array of { d0, d1, ... , dn }

Parameters:
componentType the component type of the new array
dimensions the dimensions of the new array
Returns:
the new array
Exceptions:
java.lang.NullPointerException if the component type is null
java.lang.NegativeArraySizeException if any of the dimensions are negative
java.lang.IllegalArgumentException if the array of dimensions is of size zero, or exceeds the limit of the number of dimension for an array (currently 255)

static Object java.lang.reflect.Array.newInstance ( Class<?>  componentType,
int  size 
) throws NegativeArraySizeException [static]

Return a new array of the specified component type and length.

This reproduces the effect of new componentType[size]

Parameters:
componentType the component type of the new array
size the length of the new array
Returns:
the new array
Exceptions:
java.lang.NullPointerException if the component type is null
java.lang.NegativeArraySizeException if the size if negative

static native void java.lang.reflect.Array.set ( Object  array,
int  index,
Object  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the value.

This reproduces the effect of array[index] = value If the array component is a base type, the value is automatically unwrapped

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setBoolean ( Object  array,
int  index,
boolean  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the boolean value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setByte ( Object  array,
int  index,
byte  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the byte value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setChar ( Object  array,
int  index,
char  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the char value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setDouble ( Object  array,
int  index,
double  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the double value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setFloat ( Object  array,
int  index,
float  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the float value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setInt ( Object  array,
int  index,
int  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the int value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setLong ( Object  array,
int  index,
long  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the long value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length

static native void java.lang.reflect.Array.setShort ( Object  array,
int  index,
short  value 
) throws IllegalArgumentException, ArrayIndexOutOfBoundsException [static]

Set the element of the array at the specified index to the short value.

This reproduces the effect of array[index] = value

Parameters:
array the array
index the index
value the new value
Exceptions:
java.lang.NullPointerException if the array is null
java.lang.IllegalArgumentException if the array is not an array or the value cannot be converted to the array type by a widening conversion
java.lang.ArrayIndexOutOfBoundsException if the index is out of bounds -- negative or greater than or equal to the array length


The documentation for this class was generated from the following file:

Genereated on Tue Dec 9 14:09:48 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.