- 
- All Superinterfaces:
- Mirror,- ObjectReference,- Value
 
 public interface ArrayReference extends ObjectReference Provides access to an array object and its components in the target VM. Each array component is mirrored by aValueobject. The array components, in aggregate, are placed inListobjects instead of arrays for consistency with the rest of the API and for interoperability with other APIs.- Since:
- 1.3
 
- 
- 
Field Summary- 
Fields declared in interface com.sun.jdi.ObjectReferenceINVOKE_NONVIRTUAL, INVOKE_SINGLE_THREADED
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description ValuegetValue(int index)Returns an array component value.List<Value>getValues()Returns all of the components in this array.List<Value>getValues(int index, int length)Returns a range of array components.intlength()Returns the number of components in this array.voidsetValue(int index, Value value)Replaces an array component with another value.voidsetValues(int index, List<? extends Value> values, int srcIndex, int length)Replaces a range of array components with other values.voidsetValues(List<? extends Value> values)Replaces all array components with other values.- 
Methods declared in interface com.sun.jdi.MirrortoString, virtualMachine
 - 
Methods declared in interface com.sun.jdi.ObjectReferencedisableCollection, enableCollection, entryCount, equals, getValue, getValues, hashCode, invokeMethod, isCollected, owningThread, referenceType, referringObjects, setValue, uniqueID, waitingThreads
 
- 
 
- 
- 
- 
Method Detail- 
lengthint length() Returns the number of components in this array.- Returns:
- the integer count of components in this array.
 
 - 
getValueValue getValue(int index) Returns an array component value.- Parameters:
- index- the index of the component to retrieve
- Returns:
- the Valueat the given index.
- Throws:
- IndexOutOfBoundsException- if- indexis outside the range of this array, that is, if either of the following are true:- index < 0 index >=- length()
 
 - 
getValuesList<Value> getValues() Returns all of the components in this array.- Returns:
- a list of Valueobjects, one for each array component ordered by array index. For zero length arrays, an empty list is returned.
 
 - 
getValuesList<Value> getValues(int index, int length) Returns a range of array components.- Parameters:
- index- the index of the first component to retrieve
- length- the number of components to retrieve, or -1 to retrieve all components to the end of this array.
- Returns:
- a list of Valueobjects, one for each requested array component ordered by array index. When there are no elements in the specified range (e.g.lengthis zero) an empty list is returned
- Throws:
- IndexOutOfBoundsException- if the range specified with- indexand- lengthis not within the range of the array, that is, if either of the following are true:- index < 0 index >or if- length()- length != -1and either of the following are true:- length < 0 index + length >- length()
 
 - 
setValuevoid setValue(int index, Value value) throws InvalidTypeException, ClassNotLoadedExceptionReplaces an array component with another value.Object values must be assignment compatible with the component type (This implies that the component type must be loaded through the declaring class's class loader). Primitive values must be either assignment compatible with the component type or must be convertible to the component type without loss of information. See JLS section 5.2 for more information on assignment compatibility. - Parameters:
- value- the new value
- index- the index of the component to set
- Throws:
- IndexOutOfBoundsException- if- indexis outside the range of this array, that is, if either of the following are true:- index < 0 index >=- length()
- InvalidTypeException- if the type of- valueis not compatible with the declared type of array components.
- ClassNotLoadedException- if the array component type has not yet been loaded through the appropriate class loader.
- VMCannotBeModifiedException- if the VirtualMachine is read-only - see- VirtualMachine.canBeModified().
- See Also:
- ArrayType.componentType()
 
 - 
setValuesvoid setValues(List<? extends Value> values) throws InvalidTypeException, ClassNotLoadedException Replaces all array components with other values. If the given list is larger in size than the array, the values at the end of the list are ignored.Object values must be assignment compatible with the element type (This implies that the component type must be loaded through the enclosing class's class loader). Primitive values must be either assignment compatible with the component type or must be convertible to the component type without loss of information. See JLS section 5.2 for more information on assignment compatibility. - Parameters:
- values- a list of- Valueobjects to be placed in this array. If- values.size()is less that the length of the array, the first- values.size()elements are set.
- Throws:
- InvalidTypeException- if any of the new- valuesis not compatible with the declared type of array components.
- ClassNotLoadedException- if the array component type has not yet been loaded through the appropriate class loader.
- VMCannotBeModifiedException- if the VirtualMachine is read-only - see- VirtualMachine.canBeModified().
- See Also:
- ArrayType.componentType()
 
 - 
setValuesvoid setValues(int index, List<? extends Value> values, int srcIndex, int length) throws InvalidTypeException, ClassNotLoadedExceptionReplaces a range of array components with other values.Object values must be assignment compatible with the component type (This implies that the component type must be loaded through the enclosing class's class loader). Primitive values must be either assignment compatible with the component type or must be convertible to the component type without loss of information. See JLS section 5.2 for more information on assignment compatibility. - Parameters:
- index- the index of the first component to set.
- values- a list of- Valueobjects to be placed in this array.
- srcIndex- the index of the first source value to use.
- length- the number of components to set, or -1 to set all components to the end of this array or the end of- values(whichever comes first).
- Throws:
- InvalidTypeException- if any element of- valuesis not compatible with the declared type of array components.
- IndexOutOfBoundsException- if the array range specified with- indexand- lengthis not within the range of the array, or if the source range specified with- srcIndexand- lengthis not within- values, that is, if any of the following are true:- index < 0 index >or if- length()srcIndex < 0 srcIndex > values.size()- length != -1and any of the following are true:- length < 0 index + length >- length()srcIndex + length > values.size()
- VMCannotBeModifiedException- if the VirtualMachine is read-only - see- VirtualMachine.canBeModified().
- ClassNotLoadedException
- See Also:
- ArrayType.componentType()
 
 
- 
 
-