public abstract class DebugValue extends Object
IllegalStateException
. DebugValue instances neither support equality or preserve identity.
Clients may access the debug value only on the execution thread where the suspended event of the
stack frame was created and notification received; access from other threads will throw
IllegalStateException.
| Modifier and Type | Method and Description |
|---|---|
abstract <T> T |
as(Class<T> clazz)
Converts the debug value into a Java type.
|
DebugValue |
asInLanguage(LanguageInfo language)
Returns a debug value that presents itself as seen by the provided language.
|
abstract String |
asString()
Returns the
String value if this value represents a string. |
boolean |
canExecute()
Returns
true if this value can be executed (represents a guest language
function), else false. |
DebugValue |
execute(DebugValue... arguments)
Executes the executable represented by this value.
|
List<DebugValue> |
getArray()
Provides array elements when this value represents an array.
|
DebugValue |
getMetaObject()
Get a meta-object of this value, if any.
|
abstract String |
getName()
Returns the name of this value as it is referred to from its origin.
|
LanguageInfo |
getOriginalLanguage()
Get the original language that created the value, if any.
|
Collection<DebugValue> |
getProperties()
Provides properties representing an internal structure of this value.
|
DebugValue |
getProperty(String name)
Get a property value by its name.
|
DebugScope |
getScope()
Get the scope where this value is declared in.
|
SourceSection |
getSourceLocation()
Get a source location where this value is declared, if any.
|
abstract boolean |
hasReadSideEffects()
Returns
true if reading of this value can have side-effects, else
false. |
abstract boolean |
hasWriteSideEffects()
Returns
true if setting a new value can have side-effects, else
false. |
boolean |
isArray()
Returns
true if this value represents an array, false otherwise. |
abstract boolean |
isInternal()
Returns
true if this value represents an internal variable or property,
false otherwise. |
boolean |
isNull()
Test if the value represents 'null'.
|
abstract boolean |
isReadable()
Returns
true if this value can be read else false. |
abstract boolean |
isWritable()
Returns
true if this value can be written to, else false. |
abstract void |
set(DebugValue value)
Sets the value using another
DebugValue. |
abstract void |
set(Object primitiveValue)
Sets a primitive value.
|
String |
toString()
Returns a string representation of the debug value.
|
public abstract void set(DebugValue value) throws DebugException
DebugValue. Throws an IllegalStateException if
the value is not writable, the passed value is not readable, this value or the passed value
is invalid, or the guest language of the values do not match. Use
DebugStackFrame.eval(String) to evaluate values to be set.value - the value to setDebugException - when guest language code throws an exceptionpublic abstract void set(Object primitiveValue) throws DebugException
IllegalStateException if the value is not writable and
IllegalArgumentException if the value is not primitive.primitiveValue - a primitive value to setDebugException - when guest language code throws an exceptionpublic abstract <T> T as(Class<T> clazz) throws DebugException
String.class converts the value to its language specific string representation.
Number.class converts the value to a Number representation, if any.Boolean.class converts the value to a Boolean representation, if any.UnsupportedOperationException is thrown. If the value is not readable then an IllegalStateException is thrown.clazz - the type to convert tonull when the conversion was not possible.DebugException - when guest language code throws an exceptionpublic abstract String asString() throws DebugException
String value if this value represents a string. This method returns
null otherwise.DebugException - when guest language code throws an exceptionpublic abstract String getName()
null is returned.public abstract boolean isReadable()
true if this value can be read else false.DebugValue.as(Class)public abstract boolean hasReadSideEffects()
true if reading of this value can have side-effects, else
false. Read has side-effects if it changes runtime state.public abstract boolean hasWriteSideEffects()
true if setting a new value can have side-effects, else
false. Write has side-effects if it changes runtime state besides this value.public abstract boolean isWritable()
true if this value can be written to, else false.DebugValue.as(Class)public abstract boolean isInternal()
true if this value represents an internal variable or property,
false otherwise.
Languages might have extra object properties or extra scope variables that are a part of the runtime, but do not correspond to anything what is an explicit part of the guest language representation. They may represent additional language artifacts, providing more in-depth information that can be valuable during debugging. Language implementors mark these variables as internal. An example of such internal values are internal slots in ECMAScript.
public DebugScope getScope()
null for object properties and other heap
values.null when this value does not belong into any scope.public final boolean isNull()
public final Collection<DebugValue> getProperties() throws DebugException
readable then an
IllegalStateException is thrown.DebugException - when guest language code throws an exceptionIllegalStateException - if the value is not readablepublic final DebugValue getProperty(String name) throws DebugException
name - name of a propertynull if the property does not exist.DebugException - when guest language code throws an exceptionIllegalStateException - if the value is not readablepublic final boolean isArray()
throws DebugException
true if this value represents an array, false otherwise.DebugException - when guest language code throws an exceptionpublic final List<DebugValue> getArray() throws DebugException
DebugValue.isArray().null when the value does not represent an
array.DebugException - when guest language code throws an exceptionpublic final DebugValue getMetaObject() throws DebugException
nullDebugException - when guest language code throws an exceptionpublic final SourceSection getSourceLocation() throws DebugException
nullDebugException - when guest language code throws an exceptionpublic final boolean canExecute()
throws DebugException
true if this value can be executed (represents a guest language
function), else false.DebugExceptionpublic final DebugValue execute(DebugValue... arguments) throws DebugException
arguments - Arguments passed to the executableDebugException - when guest language code throws an exceptionDebugValue.canExecute()public final LanguageInfo getOriginalLanguage() throws DebugException
null for values representing a primitive value, or objects that are not
associated with any language.null when no language can be identified as the creator
of the value.DebugException - when guest language code throws an exceptionpublic final DebugValue asInLanguage(LanguageInfo language)
DebugValue.as(java.lang.Class), DebugValue.getMetaObject() and
DebugValue.getSourceLocation(). Properties, array elements and other attributes are not
affected by a language. The original language of the returned
value remains the same as of this value.language - a language to get the value representation of