Invocation API 1.1.0.Final

org.jboss.invocation
Class InterceptorContext

java.lang.Object
  extended by org.jboss.invocation.InterceptorContext
All Implemented Interfaces:
Cloneable

public final class InterceptorContext
extends Object
implements Cloneable

An interceptor/invocation context object.

Author:
David M. Lloyd

Constructor Summary
InterceptorContext()
           
 
Method Summary
 InterceptorContext clone()
          Clone this interceptor context instance.
 Map<String,Object> getContextData()
          Get the context data which is reported to the interceptor invocation context.
 List<Interceptor> getInterceptors()
          Get the current interceptors.
 javax.interceptor.InvocationContext getInvocationContext()
          Get the invocation context.
 Method getMethod()
          Get the invoked method which is reported to the interceptor invocation context.
 int getNextInterceptorIndex()
          Returns the next interceptor index.
 Object[] getParameters()
          Get the method parameters which are reported to the interceptor invocation context.
<T> T
getPrivateData(Class<T> type)
          Get a private data item.
 Object getPrivateData(Object key)
          Get a private data item.
 Object getTarget()
          Get the invocation target which is reported to the interceptor invocation context.
 Object getTimer()
          Get the timer object which is reported to the interceptor invocation context.
 Object proceed()
          Pass the invocation on to the next step in the chain.
<T> T
putPrivateData(Class<T> type, T value)
          Insert a private data item.
 Object putPrivateData(Object key, Object value)
          Insert a private data item.
 void setContextData(Map<String,Object> contextData)
          Set the context data which is reported to the interceptor invocation context.
 void setInterceptors(List<Interceptor> interceptors)
          Set the interceptor iterator.
 void setInterceptors(List<Interceptor> interceptors, int nextIndex)
          Set the interceptors.
 void setMethod(Method method)
          Set the invoked method which is reported to the interceptor invocation context.
 void setParameters(Object[] parameters)
          Set the method parameters which are reported to the interceptor invocation context.
 void setTarget(Object target)
          Set the invocation target which is reported to the interceptor invocation context.
 void setTimer(Object timer)
          Set the timer object which is reported to the interceptor invocation context.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterceptorContext

public InterceptorContext()
Method Detail

getTarget

public Object getTarget()
Get the invocation target which is reported to the interceptor invocation context.

Returns:
the invocation target

setTarget

public void setTarget(Object target)
Set the invocation target which is reported to the interceptor invocation context.

Parameters:
target - the invocation target

getMethod

public Method getMethod()
Get the invoked method which is reported to the interceptor invocation context.

Returns:
the method

setMethod

public void setMethod(Method method)
Set the invoked method which is reported to the interceptor invocation context.

Parameters:
method - the method

getParameters

public Object[] getParameters()
Get the method parameters which are reported to the interceptor invocation context.

Returns:
the method parameters

setParameters

public void setParameters(Object[] parameters)
Set the method parameters which are reported to the interceptor invocation context.

Parameters:
parameters - the method parameters

getContextData

public Map<String,Object> getContextData()
                                  throws IllegalStateException
Get the context data which is reported to the interceptor invocation context.

Returns:
the context data
Throws:
IllegalStateException - if the context data was never initialized

setContextData

public void setContextData(Map<String,Object> contextData)
Set the context data which is reported to the interceptor invocation context.

Parameters:
contextData - the context data

getTimer

public Object getTimer()
Get the timer object which is reported to the interceptor invocation context.

Returns:
the timer object

setTimer

public void setTimer(Object timer)
Set the timer object which is reported to the interceptor invocation context.

Parameters:
timer - the timer object

getInvocationContext

public javax.interceptor.InvocationContext getInvocationContext()
Get the invocation context.

Returns:
the invocation context

getPrivateData

public <T> T getPrivateData(Class<T> type)
Get a private data item.

Type Parameters:
T - the data type
Parameters:
type - the data type class object
Returns:
the data item or null if no such item exists

getPrivateData

public Object getPrivateData(Object key)
Get a private data item. The key will be looked up by object identity, not by value.

Parameters:
key - the object key
Returns:
the private data object

putPrivateData

public <T> T putPrivateData(Class<T> type,
                            T value)
Insert a private data item.

Type Parameters:
T - the data type
Parameters:
type - the data type class object
value - the data item value, or null to remove the mapping
Returns:
the data item which was previously mapped to this position, or null if no such item exists

putPrivateData

public Object putPrivateData(Object key,
                             Object value)
Insert a private data item. The key is used by object identity, not by value; in addition, if the key is a Class then the value given must be assignable to that class.

Parameters:
key - the data key
value - the data item value, or null to remove the mapping
Returns:
the data item which was previously mapped to this position, or null if no such item exists

getInterceptors

public List<Interceptor> getInterceptors()
Get the current interceptors.

Returns:
the interceptors

getNextInterceptorIndex

public int getNextInterceptorIndex()
Returns the next interceptor index.

Returns:

setInterceptors

public void setInterceptors(List<Interceptor> interceptors)
Set the interceptor iterator.

Parameters:
interceptors - the interceptor list

setInterceptors

public void setInterceptors(List<Interceptor> interceptors,
                            int nextIndex)
Set the interceptors. With a starting index to proceed from.

Parameters:
interceptors - the interceptor list
nextIndex - the next index to proceed

proceed

public Object proceed()
               throws Exception
Pass the invocation on to the next step in the chain.

Returns:
the result
Throws:
Exception - if an invocation throws an exception

clone

public InterceptorContext clone()
Clone this interceptor context instance. The cloned context will resume execution at the same point that this context would have at the moment it was cloned.

Overrides:
clone in class Object
Returns:
the copied context

Invocation API 1.1.0.Final

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