Class DelegatingHandler
- java.lang.Object
-
- com.tonic.analysis.execution.invoke.DelegatingHandler
-
- All Implemented Interfaces:
InvocationHandler
public final class DelegatingHandler extends Object implements InvocationHandler
Invocation handler that routes every call through a user-supplied callback, converting thrown Java exceptions into guest heap exceptions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDelegatingHandler.InvocationCallbackCallback that performs a delegated method invocation and returns its concrete result.
-
Constructor Summary
Constructors Constructor Description DelegatingHandler(DelegatingHandler.InvocationCallback callback)Creates a handler that forwards invocations to the given callback.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InvocationResultinvoke(MethodEntry method, ObjectInstance receiver, ConcreteValue[] args, InvocationContext context)Executes a resolved call.
-
-
-
Constructor Detail
-
DelegatingHandler
public DelegatingHandler(DelegatingHandler.InvocationCallback callback)
Creates a handler that forwards invocations to the given callback.- Parameters:
callback- the delegate that performs each invocation- Throws:
IllegalArgumentException- if callback is null
-
-
Method Detail
-
invoke
public InvocationResult invoke(MethodEntry method, ObjectInstance receiver, ConcreteValue[] args, InvocationContext context)
Description copied from interface:InvocationHandlerExecutes a resolved call.- Specified by:
invokein interfaceInvocationHandler- Parameters:
method- the resolved targetreceiver- the instance for an instance call, null for a static callargs- the argument values in declaration ordercontext- the interpreter services available for the duration of the call- Returns:
- the outcome: a completed value, a guest exception, a delegation, or a frame to push
-
-