Package org.jboss.invocation
Class MethodInterceptor
- java.lang.Object
-
- org.jboss.invocation.MethodInterceptor
-
- All Implemented Interfaces:
Interceptor
public final class MethodInterceptor extends Object implements Interceptor
A method interceptor. The target method should be non-final and must accept no parameters or a single parameter of typeInvocationContext(or any supertype thereof). The method must belong to the given interceptor object's class or one of its supertypes.- Author:
- David M. Lloyd
-
-
Field Summary
-
Fields inherited from interface org.jboss.invocation.Interceptor
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description MethodInterceptor(Object interceptorInstance, Method method)Construct a new instance.MethodInterceptor(Object interceptorInstance, Method method, boolean changeMethod)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectprocessInvocation(InterceptorContext context)Process an invocation.
-
-
-
Constructor Detail
-
MethodInterceptor
public MethodInterceptor(Object interceptorInstance, Method method, boolean changeMethod)
Construct a new instance. The given method should be a proper interceptor method; otherwise invocation may fail.- Parameters:
interceptorInstance- the interceptor object instancemethod- the interceptor methodchangeMethod-trueto change the method on the context to equal the given method,falseto leave it as-is
-
-
Method Detail
-
processInvocation
public Object processInvocation(InterceptorContext context) throws Exception
Process an invocation. The invocation can be handled directly, or passed on to the next processor in the chain.- Specified by:
processInvocationin interfaceInterceptor- Parameters:
context- the interceptor context- Returns:
- the result of the invocation
- Throws:
Exception- If the underlying invocation resulted in some exception
-
-