public interface DynamicContext
Provides access to dynamic information available at runtime at the location where the snippet is inlined.
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getException()
Returns the exception reference to snippets inlined in the @After or the @AfterThrowing
context,
null otherwise. |
<T> T |
getLocalVariableValue(int slotIndex,
java.lang.Class<T> valueType)
Returns the value of a local variable occupying a particular local
variable slot (or two slots, in case of wide types such as long and
double).
|
<T> T |
getMethodArgumentValue(int argumentIndex,
java.lang.Class<T> valueType)
Returns the value of a particular method argument.
|
<T> T |
getStackValue(int itemIndex,
java.lang.Class<T> valueType)
Returns the value of a particular item on the JVM operand stack.
|
java.lang.Object |
getThis()
Returns
this reference to snippets inlined in an instance method,
null for snippets inlined in a static method. |
java.lang.Object getThis()
Returns this
reference to snippets inlined in an instance method,
null
for snippets inlined in a static method.
java.lang.Throwable getException()
Returns the exception reference to snippets inlined in the @After or the @AfterThrowing
context, null
otherwise.
<T> T getStackValue(int itemIndex, java.lang.Class<T> valueType)
Returns the value of a particular item on the JVM operand stack.
Note: Each item index corresponds to one operand on the stack. Both primitive and wide values are considered to be a single item, i.e., the index of the corresponding stack slot is determined automatically.
itemIndex
-
index of the item on the operand stack, must be positive and
not exceed the number of items on the stack. Index 0
refers to an item at the top of the stack.
valueType
- the expected type of the accessed value. Primitive types are boxed into corresponding reference types.
The value of the selected stack item. Primitive types are boxed into corresponding reference types.
<T> T getMethodArgumentValue(int argumentIndex, java.lang.Class<T> valueType)
Returns the value of a particular method argument.
Note: Each argument index corresponds to one method argument, be it primitive or wide, i.e., the index of the corresponding local variable slot is determined automatically.
argumentIndex
-
index of the desired method argument, must be positive and not
exceed the number of method arguments. Index 0
refers
to the first argument.
valueType
- the expected type of the accessed value.
The value of the selected method argument. Primitive types are boxed into corresponding reference types.
<T> T getLocalVariableValue(int slotIndex, java.lang.Class<T> valueType)
Returns the value of a local variable occupying a particular local variable slot (or two slots, in case of wide types such as long and double).
Note: Each slot index corresponds to one local variable slot. The value of wide values is obtained from two consecutive local variable slots, starting with the given slot index.
slotIndex
-
index of the desired local variable slot, must be positive and
not exceed the number of local variable slots. Index 0
refers to the first local variable slot.
valueType
- the expected type of the accessed value.
The value of the selected local variable slot. Primitive types are boxed into corresponding reference types.