public interface Value
Modifier and Type | Method and Description |
---|---|
void |
disableCollection()
Prevents garbage collection for languages that have garbage collection.
|
void |
enableCollection()
Allows garbage collection for languages that have garbage collection.
|
Type |
getArrayComponentType(DebugContext context)
Gets the type of the elements of this array.
|
Value |
getArrayElement(DebugContext context,
int index)
Gets the value of an array element.
|
List<Value> |
getArrayElements(DebugContext context)
Gets the values in an array.
|
List<Value> |
getArrayElements(DebugContext context,
int offset,
int length)
Gets the values in an array.
|
int |
getArrayLength(DebugContext context)
Gets the array length if this value represents an array.
|
String |
getDescription(String title,
Type declaredType,
String refPrefix)
Gets a description of the value.
|
Value |
getFieldValue(DebugContext context,
Field f)
Gets the value of a field.
|
Value |
getFieldValue(DebugContext context,
String fieldName)
Gets the value of a field.
|
Method |
getMethod(DebugContext context,
String methodName,
String returnType,
String[] argumentTypes)
Gets a method that can be invoked on the object.
|
Object |
getNativeValue()
For use with viewers that need to do special-case handling of
debugger-specific values.
|
Type |
getType(DebugContext context)
Gets the type of this Value.
|
long |
getUniqueID()
Gets a unique id if possible.
|
String |
getValueString()
Gets a source code representation of the value, if there is one.
|
Value |
invokeMethod(DebugContext context,
Method method,
Value[] arguments)
Invokes a method.
|
boolean |
isArray()
Determines if this value is an array.
|
boolean |
isInstanceOf(DebugContext context,
String typeName)
Determines if this value is an instance of some class or interface.
|
boolean |
isNull()
Determines if this value is the null object.
|
boolean |
isObject()
Determines if this value is an object, as opposed to a primitive.
|
boolean |
isPrimitive()
Determines if this value is a primitive.
|
boolean |
isSame(Value v)
Determines if this value is the same as another.
|
boolean |
isSameNaN(Value v)
Determines if this value is the same as another, where all NaN value are
considered equal.
|
void |
setFieldValue(DebugContext context,
Field f,
Value value)
Sets the value of a field.
|
void |
setFieldValue(DebugContext context,
String fieldName,
Value value)
Sets the value of a field.
|
boolean |
toBoolean(DebugContext context)
If the value is a type that can have true and false values, returns the
true or false value.
|
byte |
toByte(DebugContext context)
If the value is a type that can be represented as a byte, returns that
value.
|
char |
toChar(DebugContext context)
If the value is a type that can be represented as a char, returns that
value.
|
double |
toDouble(DebugContext context)
If the value is a type that can be represented as a double, returns that
value.
|
float |
toFloat(DebugContext context)
If the value is a type that can be represented as a float, returns that
value.
|
int |
toInt(DebugContext context)
If the value is a type that can be represented as an int, returns that
value.
|
long |
toLong(DebugContext context)
If the value is a type that can be represented as a long, returns that
value.
|
short |
toShort(DebugContext context)
If the value is a type that can be represented as a short, returns that
value.
|
String |
toString(DebugContext context)
Gets a string representation of the value, suitable for display.
|
void disableCollection()
void enableCollection()
Type getArrayComponentType(DebugContext context) throws ValueIsNotAnArrayException
context
- the current workbench or debugger context.ValueIsNotAnArrayException
- If the value is not an array.Value getArrayElement(DebugContext context, int index) throws ValueIsNotAnArrayException
context
- the current workbench or debugger context.index
- the array index.ValueIsNotAnArrayException
- If the value is not an array.IndexOutOfBoundsException
- If array is bounded and the
index is out of bounds.List<Value> getArrayElements(DebugContext context) throws ValueIsNotAnArrayException
context
- the current workbench or debugger context.ValueIsNotAnArrayException
- If the value is not an array.List<Value> getArrayElements(DebugContext context, int offset, int length) throws ValueIsNotAnArrayException
context
- the current workbench or debugger context.offset
- the start index for the values.length
- the number of values to return.offset
to
offset
+ length
- 1.ValueIsNotAnArrayException
- If the value is not an array.IndexOutOfBoundsException
- If array is bounded and
offset
or offset
+ length
- 1 is
out of bounds.int getArrayLength(DebugContext context) throws ValueIsNotAnArrayException
context
- the current workbench or debugger context.ValueIsNotAnArrayException
- if this Value does not represent an
array.String getDescription(String title, Type declaredType, String refPrefix)
title
- a name for the value. This may be null.declaredType
- the declared type.refPrefix
- a prefix to display before the declared type, or null if
none should be displayed.Value getFieldValue(DebugContext context, Field f) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException
context
- the current workbench or debugger context.f
- the 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.Value getFieldValue(DebugContext context, String fieldName) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException
context
- the current workbench or debugger context.fieldName
- the name of the 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
in Value.Method getMethod(DebugContext context, String methodName, String returnType, String[] argumentTypes) throws ValueIsNotAnObjectException, 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.ValueIsNotAnObjectException
- If the value is not an object, or is
of a type that does not have methods.JgrdiNoSuchMethodException
- If the specified method does not
exist.Object getNativeValue()
Viewer.update(jgrasp.viewer.ViewerValueData, jgrasp.viewer.ViewerUpdateData, jgrasp.viewer.jgrdi.DebugContext)
.Type getType(DebugContext context)
context
- the current workbench or debugger context.long getUniqueID()
String getValueString()
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.ValueIsNotAnObjectException
- If the value is not an object, or is
of a type for which a method can not be invoked.IllegalArgumentException
- If the method is not a member
of the value's class, 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 isInstanceOf(DebugContext context, String typeName)
context
- the current workbench or debugger context.typeName
- the class of interface name.boolean isNull()
boolean isObject()
boolean isPrimitive()
boolean isSame(Value v)
v
- the value to compare.boolean isSameNaN(Value v)
v
- the value to be compared.void setFieldValue(DebugContext context, Field f, Value value) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException, JgrdiIsFinalException, BadArgumentException
context
- the current workbench or debugger context.f
- the field of interest.value
- the value to set.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.JgrdiIsFinalException
- if the field is final.BadArgumentException
- If the type of value
is not
appropriate for field f
.void setFieldValue(DebugContext context, String fieldName, Value value) throws ValueIsNotAnObjectException, JgrdiNoSuchFieldException, JgrdiIsFinalException, BadArgumentException
context
- the current workbench or debugger context.fieldName
- the name of the field.value
- the value to set.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.JgrdiIsFinalException
- if the field is final.BadArgumentException
- if the type of value
is not
appropriate for the field.boolean toBoolean(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as a
boolean.byte toByte(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as a
byte.char toChar(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as a
char.double toDouble(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as a
double.float toFloat(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as a
float.int toInt(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as an
int.long toLong(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as a
long.short toShort(DebugContext context) throws NoConversionException
context
- the current workbench or debugger context.NoConversionException
- if the type is not representable as a
short.String toString(DebugContext context) throws ViewerException
context
- the current debug context.ViewerException
- If the workbench or debugger is in a state that
does not allow invoking a method, or some other error occurs.