Invocation API 1.1.0.Final

org.jboss.invocation
Class MethodInterceptor

java.lang.Object
  extended by 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 type InvocationContext (or any supertype thereof). The method must belong to the given interceptor object's class or one of its supertypes.

Author:
David M. Lloyd

Constructor Summary
MethodInterceptor(Object interceptorInstance, Method method)
          Construct a new instance.
MethodInterceptor(Object interceptorInstance, Method method, boolean changeMethod)
          Construct a new instance.
 
Method Summary
 Object processInvocation(InterceptorContext context)
          Process an invocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 instance
method - the interceptor method
changeMethod - true to change the method on the context to equal the given method, false to leave it as-is

MethodInterceptor

public MethodInterceptor(Object interceptorInstance,
                         Method method)
Construct a new instance. The given method should be a proper interceptor method; otherwise invocation may fail.

Parameters:
interceptorInstance - the interceptor object instance
method - the interceptor method
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:
processInvocation in interface Interceptor
Parameters:
context - the interceptor context
Returns:
the result of the invocation
Throws:
Exception - If the underlying invocation resulted in some exception

Invocation API 1.1.0.Final

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.