org.beanlet
Interface InvocationContext


public interface InvocationContext

Allow interceptor and lifecycle methods to control the behavior of the invocation chain.

The same InvocationContext instance is passed to each interceptor method for a given business method or lifecycle event interception. This allows an interceptor to save information in the context data property of the InvocationContext that can be subsequently retrieved in other interceptors as means to pass contextual data between interceptors. The contextual data is not shareable across separate business method invocations or lifecycle callback events. The lifecycle of the InvocationContext is instance otherwise unspecified.


Method Summary
 Map<String,Object> getContextData()
          Returns a map that can be used to pass contextual data between interceptors of the interceptor chain.
 Method getMethod()
          The method that is intercepted.
 Object[] getParameters()
          Returns the parameter of the current invocation.
 Object getTarget()
          Returns the underlying object.
 Object proceed()
          Invokes the next interceptor in the chain, or, when called from the last interceptor, the business method.
 void setParameters(Object[] parameters)
          Allows the caller to modify the parameters of the current invocation.
 

Method Detail

getContextData

Map<String,Object> getContextData()
Returns a map that can be used to pass contextual data between interceptors of the interceptor chain.


getMethod

Method getMethod()
                 throws BeanletStateException
The method that is intercepted. This method does not return null, since only methods can be intercepted.

Throws:
BeanletStateException - if this method is called from an lifecycle interceptor.

getParameters

Object[] getParameters()
                       throws BeanletStateException
Returns the parameter of the current invocation.

Throws:
BeanletStateException - if this method is called from an lifecycle interceptor.

setParameters

void setParameters(Object[] parameters)
                   throws BeanletStateException
Allows the caller to modify the parameters of the current invocation.

Throws:
BeanletStateException - if this method is called from an lifecycle interceptor.

proceed

Object proceed()
               throws Exception
Invokes the next interceptor in the chain, or, when called from the last interceptor, the business method. Interceptor methods must always call InvocationContext.proceed() or nu subsequent interceptor methods or lifecycle callback methods or business method will be invoked. The proceed method returns the result of the next method invoked. If a method returns void, proceed returns null. For lifecycle callback methods, if there is no callback method defined on the beanlet class, the invocation of proceed in the last method in the chain is a on-op, and null is returned. If there is more than one such method, the invocation of proceed causes the application container to execute those methods in order.

Returns:
result of next method.
Throws:
Exception

getTarget

Object getTarget()
Returns the underlying object.

Returns:
the underlying object.


Copyright © 2006-2012. All Rights Reserved.