Top Description Inners Fields Constructors Methods
org.jvnet.hk2.internal

public Class MethodInterceptorHandler

extends Object
implements MethodHandler
Class Inheritance
All Implemented Interfaces
javassist.util.proxy.MethodHandler
Imports
java.lang.reflect.AccessibleObject, .Method, java.security.AccessController, .PrivilegedAction, java.util.ArrayList, .HashMap, .List, .Map, .RandomAccess, org.aopalliance.intercept.MethodInterceptor, .MethodInvocation, org.glassfish.hk2.api.AOPProxyCtl, .ActiveDescriptor, .HK2Invocation, org.glassfish.hk2.utilities.reflection.Logger, .ReflectionHelper, javassist.util.proxy.MethodHandler

This is the handler that runs the aopalliance method interception
Author
jwells

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final boolean
private final Map<Method, List<MethodInterceptor>>
private final ServiceLocatorImpl
private final ActiveDescriptor<?>

Constructor Summary

AccessConstructor and Description
pack-priv
MethodInterceptorHandler(ServiceLocatorImpl locator, ActiveDescriptor<?> underlyingDescriptor, Map<Method, List<MethodInterceptor>> interceptorLists)

Method Summary

Modifier and TypeMethod and Description
public Object
invoke(Object self, Method thisMethod, Method proceed, Object[] args)

Implements javassist.util.proxy.MethodHandler.invoke.

Is called when a method is invoked on a proxy instance associated with this handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUG_INTERCEPTIONback to summary
private static final boolean DEBUG_INTERCEPTION
interceptorListsback to summary
private final Map<Method, List<MethodInterceptor>> interceptorLists
locatorback to summary
private final ServiceLocatorImpl locator
underlyingDescriptorback to summary
private final ActiveDescriptor<?> underlyingDescriptor

Constructor Detail

MethodInterceptorHandlerback to summary
pack-priv MethodInterceptorHandler(ServiceLocatorImpl locator, ActiveDescriptor<?> underlyingDescriptor, Map<Method, List<MethodInterceptor>> interceptorLists)

Method Detail

invokeback to summary
public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable

Implements javassist.util.proxy.MethodHandler.invoke.

Doc from javassist.util.proxy.MethodHandler.invoke.

Is called when a method is invoked on a proxy instance associated with this handler. This method must process that method invocation.

Annotations
@Override
Exceptions
Throwable:
if the method invocation fails.
org.jvnet.hk2.internal back to summary

private Class MethodInterceptorHandler.MethodInvocationImpl

extends Object
implements MethodInvocation, HK2Invocation
Class Inheritance
  • java.lang.Object
  • org.jvnet.hk2.internal.MethodInterceptorHandler.MethodInvocationImpl
All Implemented Interfaces
org.glassfish.hk2.api.HK2Invocation, org.aopalliance.intercept.MethodInvocation, org.aopalliance.intercept.Invocation, org.aopalliance.intercept.Joinpoint

Field Summary

Modifier and TypeField and Description
private final Object[]
private final int
private final List<MethodInterceptor>
private final Method
private final Object
private final Method
private HashMap<String, Object>

Constructor Summary

AccessConstructor and Description
private
MethodInvocationImpl(Object[] arguments, Method method, Object myself, List<MethodInterceptor> interceptors, int index, Method proceed, HashMap<String, Object> userData)

Method Summary

Modifier and TypeMethod and Description
public Object[]
getArguments()

Implements org.aopalliance.intercept.Invocation.getArguments.

Get the arguments as an array object.

public Method
getMethod()

Implements org.aopalliance.intercept.MethodInvocation.getMethod.

Get the method being called.

public AccessibleObject
getStaticPart()

Implements org.aopalliance.intercept.Joinpoint.getStaticPart.

Return the static part of this joinpoint.

public Object
getThis()

Implements org.aopalliance.intercept.Joinpoint.getThis.

Return the object that holds the current joinpoint's static part.

public Object
getUserData(String key)

Implements org.glassfish.hk2.api.HK2Invocation.getUserData.

Gets the user data associated with the given key

public Object
proceed()

Implements org.aopalliance.intercept.Joinpoint.proceed.

Proceed to the next interceptor in the chain.

public void
setUserData(String key, Object data)

Implements org.glassfish.hk2.api.HK2Invocation.setUserData.

Sets the user data to be associated with the invocation frame.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argumentsback to summary
private final Object[] arguments
indexback to summary
private final int index
interceptorsback to summary
private final List<MethodInterceptor> interceptors
methodback to summary
private final Method method
myselfback to summary
private final Object myself
proceedback to summary
private final Method proceed
userDataback to summary
private HashMap<String, Object> userData

Constructor Detail

MethodInvocationImplback to summary
private MethodInvocationImpl(Object[] arguments, Method method, Object myself, List<MethodInterceptor> interceptors, int index, Method proceed, HashMap<String, Object> userData)

Method Detail

getArgumentsback to summary
public Object[] getArguments()

Implements org.aopalliance.intercept.Invocation.getArguments.

Doc from org.aopalliance.intercept.Invocation.getArguments.

Get the arguments as an array object. It is possible to change element values within this array to change the arguments.

Annotations
@Override
getMethodback to summary
public Method getMethod()

Implements org.aopalliance.intercept.MethodInvocation.getMethod.

Doc from org.aopalliance.intercept.MethodInvocation.getMethod.

Get the method being called.

This method is a friendly implementation of the Joinpoint#getStaticPart() method (same result).

Annotations
@Override
getStaticPartback to summary
public AccessibleObject getStaticPart()

Implements org.aopalliance.intercept.Joinpoint.getStaticPart.

Doc from org.aopalliance.intercept.Joinpoint.getStaticPart.

Return the static part of this joinpoint.

The static part is an accessible object on which a chain of interceptors is installed.

Annotations
@Override
getThisback to summary
public Object getThis()

Implements org.aopalliance.intercept.Joinpoint.getThis.

Doc from org.aopalliance.intercept.Joinpoint.getThis.

Return the object that holds the current joinpoint's static part.

For instance, the target object for an invocation.

Annotations
@Override
getUserDataback to summary
public Object getUserData(String key)

Implements org.glassfish.hk2.api.HK2Invocation.getUserData.

Doc from org.glassfish.hk2.api.HK2Invocation.getUserData.

Gets the user data associated with the given key

Annotations
@Override
proceedback to summary
public Object proceed() throws Throwable

Implements org.aopalliance.intercept.Joinpoint.proceed.

Doc from org.aopalliance.intercept.Joinpoint.proceed.

Proceed to the next interceptor in the chain.

The implementation and the semantics of this method depends on the actual joinpoint type (see the children interfaces).

Annotations
@Override
Exceptions
Throwable:
if the joinpoint throws an exception
setUserDataback to summary
public void setUserData(String key, Object data)

Implements org.glassfish.hk2.api.HK2Invocation.setUserData.

Doc from org.glassfish.hk2.api.HK2Invocation.setUserData.

Sets the user data to be associated with the invocation frame. The key may not be null. If data is null then the data associated with the key is removed

Annotations
@Override