org.jboss.aop.array
Class ArrayReferenceImpl
java.lang.Object
org.jboss.aop.array.ArrayReferenceImpl
- All Implemented Interfaces:
- ArrayReference
public class ArrayReferenceImpl
- extends Object
- implements ArrayReference
- Version:
- $Revision: 1.1 $
- Author:
- Kabir Khan
ArrayReferenceImpl
public ArrayReferenceImpl(Object root,
String rootField)
getRootObject
public Object getRootObject()
- Specified by:
getRootObject
in interface ArrayReference
- Returns:
- The object containing the field with the array reference. If the root field is non static this
will be the reference of the instance, if the field is static it will be the class
getRootField
public String getRootField()
- Specified by:
getRootField
in interface ArrayReference
- Returns:
- The field with the array reference
addNestedArrayIndex
public void addNestedArrayIndex(Integer index)
getNestedArrayIndices
public List<Integer> getNestedArrayIndices()
- Description copied from interface:
ArrayReference
- If the root field is a direct reference to the array this will be null. If the field is an array and the reference is from within
a nested array, this will be a list of the indexes from the top to get to the array.
So if we have:
class POJO{
int[] i;
}
POJO pojo = new POJO();
int[] i arr = new int[]{1};
pojo.i = arr;
getNestedArrayIndices will be null for arr.If we have:
class POJO{
int[][][] i;
}
POJO pojo = new POJO();
int[] arr = new int[]{1};
pojo.i = new int[][][]{new int[][]{new int[]{1}}, new int[][]{new int[]{2}, new int[]{3}, arr}};
getNestedArrayIndices will {1,2} for arr.
- Specified by:
getNestedArrayIndices
in interface ArrayReference
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.