com.jrockit.memleak.value
Class ArrayInfo

java.lang.Object
  extended by com.jrockit.memleak.value.AbstractObjectInfo
      extended by com.jrockit.memleak.value.ArrayInfo
All Implemented Interfaces:
IArrayInfo, IObjectInfo, IObjectSpecifier, IClassInfoHolder, IModifyOnce

public class ArrayInfo
extends AbstractObjectInfo
implements IArrayInfo, IModifyOnce

Default implementation of IArrayInfo.

Author:
mpersson

Field Summary
 
Fields inherited from class com.jrockit.memleak.value.AbstractObjectInfo
classInfo, objectID
 
Fields inherited from interface com.jrockit.memleak.IArrayInfo
PREFIX_CHAR, PREFIX_STRING
 
Fields inherited from interface com.jrockit.memleak.IObjectInfo
EMPTY_ARRAY
 
Constructor Summary
ArrayInfo(int objectID, ClassInfo classInfo)
           
ArrayInfo(int objectID, ClassInfo classInfo, int length)
           
 
Method Summary
 IValue[] getElements(Policy policy, int from, int len)
          Get the element data from an array.
<T> T
getField(java.lang.String fieldName, java.lang.Class<T> type, Policy policy)
          Get the actual primitive wrapper or object representation of of the most visible field that has the name fieldName and is assignable to the class type as per IValue.isAssignableTo(Class) in the object represented by this IObjectInfo.
 IObjectInfo getFieldReference(java.lang.String fieldName, Policy policy)
          Get the IObjectInfo corresponding to the value of the most visible non-primitive field with the name fieldName in the object represented by this IObjectInfo.
 IFieldValue[] getFieldValues(Policy policy)
          Get the values and names for all the fields in the object represented by this IObjectInfo.
 int getLength()
           
 boolean overrideDefault(ValueProperty property, java.lang.Object value)
           
 
Methods inherited from class com.jrockit.memleak.value.AbstractObjectInfo
equals, equals, getClassInfo, getFieldValue, getKeepAliveSize, getObjectId, hashCode, isDiscarded, isValid, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jrockit.memleak.IObjectInfo
getClassInfo, getFieldValue, getKeepAliveSize, isDiscarded
 
Methods inherited from interface com.jrockit.memleak.IObjectSpecifier
getObjectId
 

Constructor Detail

ArrayInfo

public ArrayInfo(int objectID,
                 ClassInfo classInfo)
Parameters:
objectID -
classInfo -

ArrayInfo

public ArrayInfo(int objectID,
                 ClassInfo classInfo,
                 int length)
Parameters:
objectID -
classInfo -
length -
Method Detail

getLength

public int getLength()
Specified by:
getLength in interface IArrayInfo
Returns:
the array length, or -1 if not known.

overrideDefault

public boolean overrideDefault(ValueProperty property,
                               java.lang.Object value)
                        throws java.lang.ClassCastException
Specified by:
overrideDefault in interface IModifyOnce
Returns:
true if the value changed
Throws:
java.lang.ClassCastException

getFieldValues

public IFieldValue[] getFieldValues(Policy policy)
Description copied from interface: IObjectInfo
Get the values and names for all the fields in the object represented by this IObjectInfo.

Note that null may be returned, if the policy allows it.

Specified by:
getFieldValues in interface IObjectInfo
Parameters:
policy - the cache policy to use
Returns:
an array of IFieldValues representing the fields, or null according to policy

getField

public <T> T getField(java.lang.String fieldName,
                      java.lang.Class<T> type,
                      Policy policy)
           throws NoMatchingFieldException
Description copied from interface: IObjectInfo
Get the actual primitive wrapper or object representation of of the most visible field that has the name fieldName and is assignable to the class type as per IValue.isAssignableTo(Class) in the object represented by this IObjectInfo.

The most visible field is defined from a Java source perspective in that it normally would be the field that is in scope from within the actual class. More specifically, starting from the actual class and moving up the super class hierarchy, the value of the first non-synthetic field with fieldName and a matching type, is returned. If no such field is found, the value of the first synthetic field of that name and with a matching type, found by looking in the same order, is returned. If no field with that name and a matching type could be found at all, NoMatchingFieldException is thrown.

Specified by:
getField in interface IObjectInfo
Overrides:
getField in class AbstractObjectInfo
Type Parameters:
T - implicit
Parameters:
fieldName - the name of the field
policy - the cache policy to use
Returns:
an instance of T (that is, a primitive wrapper or an IObjectInfo), or null
Throws:
NoMatchingFieldException - if no field with the given name and a matching type could be found

getFieldReference

public IObjectInfo getFieldReference(java.lang.String fieldName,
                                     Policy policy)
                              throws NoMatchingFieldException
Description copied from interface: IObjectInfo
Get the IObjectInfo corresponding to the value of the most visible non-primitive field with the name fieldName in the object represented by this IObjectInfo.

The most visible field is defined from a Java source perspective in that it normally would be the field that is in scope from within the actual class. More specifically, starting from the actual class and moving up the super class hierarchy, the first non-synthetic and non-primitive field with fieldName is returned. If no such field is found, the first synthetic non-primitive field of that name, found by looking in the same order, is returned. If no non-primitive field with that name could be found at all, NoMatchingFieldException is thrown.

Specified by:
getFieldReference in interface IObjectInfo
Overrides:
getFieldReference in class AbstractObjectInfo
Parameters:
fieldName - the name of the field
policy - the cache policy to use
Returns:
an IObjectInfo representing the field, or null according to policy
Throws:
NoMatchingFieldException - if no non-primitive field with the given name could be found

getElements

public IValue[] getElements(Policy policy,
                            int from,
                            int len)
                     throws GarbageCollectedException,
                            java.lang.IndexOutOfBoundsException
Description copied from interface: IArrayInfo
Get the element data from an array.

Specified by:
getElements in interface IArrayInfo
Parameters:
policy - the cache policy
from - starting index
len - how many elements to fetch
Returns:
the values
Throws:
GarbageCollectedException
java.lang.IndexOutOfBoundsException - if from and/or len are invalid values


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.