Class GrapheneProxyHandler
java.lang.Object
org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler
- All Implemented Interfaces:
InvocationHandler,MethodInterceptor
- Direct Known Subclasses:
GrapheneContextualHandler
public abstract class GrapheneProxyHandler
extends Object
implements MethodInterceptor, InvocationHandler
Invocation handler which wraps the given target for invocation (as the target instance for future computation of target).
This handlers determines whenever the result of invocation can be proxied and if yes, it recursively wraps it with proxy using this invocation handler.
- Author:
- Lukas Fryc
-
Constructor Summary
ConstructorsConstructorDescriptionGrapheneProxyHandler(Object target) Returns invocation handler which wraps the given target instance.Returns invocation handler which wraps the target for future computation. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectComputes the target for invocation - if future target is provided, it will be returned, othewise the target instance will be returned.protected ObjectDelegates toinvoke(Object, Method, Object[])to serve asMethodInterceptor.static Objectintercept(Object self, MethodInterceptor interceptor, Method method, Object[] args) abstract ObjectEnd point for handling invocations on proxy.protected ObjectinvokeReal(Object target, Method method, Object[] args) Invokes the method on real target.protected booleanisProxyable(Method method, Object[] args) Determines whenever the given invocation can be proxied.
-
Constructor Details
-
GrapheneProxyHandler
Returns invocation handler which wraps the given target instance.- Parameters:
target- the target of invocation
-
GrapheneProxyHandler
Returns invocation handler which wraps the target for future computation.- Parameters:
future- the future target
-
-
Method Details
-
intercept
@RuntimeType public static Object intercept(@This Object self, @FieldValue("__interceptor") MethodInterceptor interceptor, @Origin Method method, @AllArguments Object[] args) throws Throwable - Throws:
Throwable
-
invoke
End point for handling invocations on proxy.
Decides whenever the result of invocation is proxyable and if yes, it returns the proxy using new instance of
GrapheneProxyHandlerwrapping the result of invocation.The method specifically handles
GrapheneProxyInstance.unwrap()method which returns the real target for invocation.- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
intercept
Delegates toinvoke(Object, Method, Object[])to serve asMethodInterceptor.- Throws:
Throwable
-
isProxyable
Determines whenever the given invocation can be proxied.- Parameters:
method- the method which is invokedargs- the arguments used for invocation- Returns:
- true if the given invocation can be proxied; false otherwise
-
invokeReal
Invokes the method on real target.
- Parameters:
target- the target to be invokedmethod- the method to be invokedargs- the arguments used for invocation- Returns:
- the result of invocation on real target
- Throws:
Throwable
-
getTarget
Computes the target for invocation - if future target is provided, it will be returned, othewise the target instance will be returned.- Returns:
- the real target for invocation
-