public interface Type
Modifier and Type | Field and Description |
---|---|
static int |
INSTANCE
Constant indicating instance (non-static) fields or methods.
|
static int |
NON_VISIBLE
Constant indicating the inclusion of non-visible methods.
|
static int |
STATIC
Constant indicating static (per-class) fields or methods.
|
static int |
SYNTHETIC
Constant indicating the inclusion of synthetic fields or methods.
|
Modifier and Type | Method and Description |
---|---|
Value |
createArray(int size)
Creates an array of this type.
|
Value |
createInstance(DebugContext context,
Constructor constructor,
Value[] arguments)
Creates an instance of this type.
|
Type |
getArrayElementType(DebugContext context)
Gets the type for array elements.
|
Constructor |
getConstructor(DebugContext context,
String[] argumentTypes)
Gets a constructor that can be used to create an object of this type.
|
Field |
getField(String fieldName)
Gets a visible field of this type by name.
|
List<Field> |
getFields()
Gets visible fields for this type.
|
List<Field> |
getFields(int flags)
Gets visible fields for this type.
|
Value |
getFieldValue(DebugContext context,
Field f)
Gets the value of a static field.
|
Value |
getFieldValue(DebugContext context,
String fieldName)
Gets the value of a static field.
|
long |
getHash()
Gets a hash code that can be used between runs.
|
Method |
getMethod(DebugContext context,
String methodName,
String returnType,
String[] argumentTypes)
Gets a static or instance method that can be invoked on this type.
|
List<Method> |
getMethods()
Gets visible methods for this type.
|
List<Method> |
getMethods(int flags)
Gets visible methods for this type.
|
String |
getName(DebugContext context)
Gets the type name, as would be used in the target language.
|
Object |
getNativeType()
For use with viewers that need to do special-case handling of
debugger-specific values.
|
List<Type> |
getSuperclassType(DebugContext context)
For object values, returns the superclass types.
|
Value |
invokeMethod(DebugContext context,
Method method,
Value[] arguments)
Invokes a static method.
|
boolean |
isArray()
Determines if this type is an array.
|
boolean |
isClassObject()
Determines if this is a class type, where a class type is an object type
that may have a superclass.
|
boolean |
isFieldVisible(Field field,
DebugContext context)
Determines if a field in the list of visible fields is visible by our
definition.
|
boolean |
isInstanceOf(DebugContext context,
String typeName)
Determines if this type is an instance of some class or interface.
|
boolean |
isInterface()
Determines if this is an interface type, where an interface type is an
object type that does not include any implementation.
|
boolean |
isObject()
Determines if this is an object type.
|
void |
setFieldValue(DebugContext context,
Field f,
Value value)
Sets the value of a static field.
|
void |
setFieldValue(DebugContext context,
String fieldName,
Value value)
Sets the value of a static field.
|
void |
validate(DebugContext context)
Makes every attempt to ensure that this type is fully loaded and
prepared.
|
static final int INSTANCE
static final int STATIC
static final int NON_VISIBLE
static final int SYNTHETIC
Value createArray(int size) throws NotArrayTypeException
size
- the size of the array.NotArrayTypeException
- if this type is not an array type.Value createInstance(DebugContext context, Constructor constructor, Value[] arguments) throws ViewerException
context
- the current workbench or debugger context.constructor
- the constructor to use.arguments
- the arguments to use.NotReferenceTypeException
- If the type is not a reference type, or
is a type that does not have constructors.IllegalArgumentException
- If the constructor is not a
member of this type, the number of arguments is incorrect, or for some
other reason the method is not invokable.BadArgumentException
- If one of the arguments is not assignable to
the corresponding argument type.ViewerException
- If the workbench or debugger is in a state that
does not allow invoking this method, or some other error occurs.Type getArrayElementType(DebugContext context) throws NotArrayTypeException
context
- the current workbench or debugger context.NotArrayTypeException
- if this type is not an array type.Constructor getConstructor(DebugContext context, String[] argumentTypes) throws NotReferenceTypeException, NoSuchConstructorException
context
- the current workbench or debugger context.argumentTypes
- type names of the arguments. Be sure to use full
class names for Java. This can be null if there are no arguments.NotReferenceTypeException
- If the type is not a reference, or is a
type that does not have constructors.NoSuchConstructorException
- If the specified constructor does not
exist.Field getField(String fieldName)
fieldName
- name of the field to retrieve.List<Field> getFields()
Value getFieldValue(DebugContext context, Field f) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException
context
- the current workbench or debugger context.f
- the static field of interest.ValueIsNotAnObjectException
- If the value is not an object, or is
of a type that does not have fields.JgrdiNoSuchFieldException
- If f
is not a field for
the type of this value, or is not static.Value getFieldValue(DebugContext context, String fieldName) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException
context
- the current workbench or debugger context.fieldName
- the name of the static field.ValueIsNotAnObjectException
- If the value is not an object, or is
of a type that does not have fields.JgrdiNoSuchFieldException
- If the specified field does not exist
or is not static.long getHash()
Method getMethod(DebugContext context, String methodName, String returnType, String[] argumentTypes) throws NotReferenceTypeException, JgrdiNoSuchMethodException
context
- the current workbench or debugger context.methodName
- name of the method.returnType
- type name of the return value.argumentTypes
- type names of the arguments. Be sure to use full
class names for Java. This can be null if there are no arguments.NotReferenceTypeException
- If the type is not a reference, or is a
type that does not have methods.JgrdiNoSuchMethodException
- If the specified method does not
exist.List<Method> getMethods()
List<Method> getMethods(int flags)
flags
- flags that restrict the methods retrieved. A combination of
INSTANCE
, STATIC
, NON_VISIBLE
and
SYNTHETIC
.String getName(DebugContext context)
context
- the current workbench or debugger context.Object getNativeType()
List<Type> getSuperclassType(DebugContext context) throws ValueIsNotAClassObjectException
context
- the current workbench or debugger context.ValueIsNotAClassObjectException
- If the value is not an
object.Value invokeMethod(DebugContext context, Method method, Value[] arguments) throws ViewerException
context
- the current workbench or debugger context.method
- the method to invoke.arguments
- the arguments to use.NotReferenceTypeException
- If the type is not a reference type, or
is a type for which a method can not be invoked.IllegalArgumentException
- If the method is not a member
of this type, the number of arguments is incorrect, or for some other
reason the method is not invokable.BadArgumentException
- If one of the arguments is not assignable to
the corresponding argument type.ViewerException
- If the workbench or debugger is in a state that
does not allow invoking this method, or some other error occurs.boolean isArray()
boolean isClassObject()
boolean isFieldVisible(Field field, DebugContext context)
field
- the field of interest.context
- the current workbench or debugger context.boolean isInstanceOf(DebugContext context, String typeName)
context
- the current workbench or debugger context.typeName
- the class of interface name.boolean isInterface()
boolean isObject()
void setFieldValue(DebugContext context, Field f, Value value) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException, BadArgumentException
context
- the current workbench or debugger context.f
- the static field of interest.value
- the new value.ValueIsNotAnObjectException
- If the value is not an object, or is
of a type that does not have fields.JgrdiNoSuchFieldException
- If f
is not a field for
the type of this value, or is not static.BadArgumentException
- If the type of value
is not
appropriate for field
.void setFieldValue(DebugContext context, String fieldName, Value value) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException, BadArgumentException
context
- the current workbench or debugger context.fieldName
- the name of the static field.value
- the new value.ValueIsNotAnObjectException
- If the value is not an object, or is
of a type that does not have fields.JgrdiNoSuchFieldException
- If the specified field does not exist
or is not static.BadArgumentException
- If the type of value
is not
appropriate for the field.void validate(DebugContext context)
context
- the current workbench or debugger context.