org.jboss.aop.joinpoint
Class InvocationBase

java.lang.Object
  extended by org.jboss.aop.joinpoint.InvocationBase
All Implemented Interfaces:
Serializable, Invocation
Direct Known Subclasses:
ArrayElementInvocation, CallerInvocation, ConstructionInvocation, ConstructorInvocation, FieldInvocation, MethodInvocation

public abstract class InvocationBase
extends Object
implements Serializable, Invocation

This is a generic object that is used in intercepted invocations on field access, constructor, and methods

Version:
$Revision: 70849 $
Author:
Bill Burke
See Also:
Serialized Form

Field Summary
protected  Advisor advisor
           
protected  int currentInterceptor
           
protected  MetaDataResolver instanceResolver
           
protected  Interceptor[] interceptors
           
protected  SimpleMetaData metadata
           
protected  Map<Object,Object> responseContextInfo
           
protected  Object targetObject
           
 
Constructor Summary
InvocationBase()
           
InvocationBase(Interceptor[] interceptors)
           
InvocationBase(Interceptor[] interceptors, SimpleMetaData meta)
           
InvocationBase(Invocation invocation)
          Copy constructor.
 
Method Summary
 void addResponseAttachment(Object key, Object val)
           
 Advisor getAdvisor()
           
 int getCurrentInterceptor()
           
 MetaDataResolver getInstanceResolver()
           
 Interceptor[] getInterceptors()
          This used to be final, but I had to get rid of that since I need to lazily initialise the interceptors from the generated joinpoint/invocation classes
 SimpleMetaData getMetaData()
          Return all the contextual data attached to this invocation
 Object getMetaData(Object group, Object attr)
          This method resolves metadata based on the context of the invocation.
 Object getResponseAttachment(Object key)
           
 Map<Object,Object> getResponseContextInfo()
           
 Object getTargetObject()
           
 Object invokeNext()
          Invoke on the next interceptor in the chain.
 Object invokeNext(Interceptor[] newInterceptors)
          Invoke on the next interceptor in the chain.
 Object invokeTarget()
          Invokes the target joinpoint for this invocation skipping any subsequent interceptors in the chain.
 Object resolveAnnotation(Class<? extends Annotation> annotation)
          Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.
 Object resolveAnnotation(Class<? extends Annotation>[] annotations)
          Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.
 Object resolveClassAnnotation(Class<? extends Annotation> annotation)
          Abstraction for resolving an annotation so that it can be overriden from the Class
 Object resolveClassMetaData(Object key, Object attr)
          Resolve class level untyped metadata based on a key and the attribute of the key
<T extends Annotation>
T
resolveTypedAnnotation(Class<T> annotation)
          Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.
<T extends Annotation>
T
resolveTypedAnnotation(Class<T>[] annotations)
          Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.
<T extends Annotation>
T
resolveTypedClassAnnotation(Class<T> annotation)
          Abstraction for resolving an annotation so that it can be overriden from the Class
 void setAdvisor(Advisor advisor)
           
 void setInstanceResolver(MetaDataResolver instanceResolver)
           
 void setMetaData(SimpleMetaData data)
          Set all the contextual data attached to this invocation
 void setResponseContextInfo(Map<Object,Object> responseContextInfo)
           
 void setTargetObject(Object targetObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.aop.joinpoint.Invocation
copy, getWrapper
 

Field Detail

metadata

protected SimpleMetaData metadata

currentInterceptor

protected transient int currentInterceptor

interceptors

protected transient Interceptor[] interceptors

advisor

protected transient Advisor advisor

responseContextInfo

protected transient Map<Object,Object> responseContextInfo

targetObject

protected transient Object targetObject

instanceResolver

protected transient MetaDataResolver instanceResolver
Constructor Detail

InvocationBase

public InvocationBase(Interceptor[] interceptors)

InvocationBase

public InvocationBase(Interceptor[] interceptors,
                      SimpleMetaData meta)

InvocationBase

public InvocationBase(Invocation invocation)
Copy constructor.


InvocationBase

public InvocationBase()
Method Detail

getResponseContextInfo

public Map<Object,Object> getResponseContextInfo()
Specified by:
getResponseContextInfo in interface Invocation

setResponseContextInfo

public void setResponseContextInfo(Map<Object,Object> responseContextInfo)
Specified by:
setResponseContextInfo in interface Invocation

addResponseAttachment

public void addResponseAttachment(Object key,
                                  Object val)
Specified by:
addResponseAttachment in interface Invocation

getResponseAttachment

public Object getResponseAttachment(Object key)
Specified by:
getResponseAttachment in interface Invocation

getMetaData

public SimpleMetaData getMetaData()
Return all the contextual data attached to this invocation

Specified by:
getMetaData in interface Invocation

setMetaData

public void setMetaData(SimpleMetaData data)
Set all the contextual data attached to this invocation

Specified by:
setMetaData in interface Invocation

resolveClassMetaData

public Object resolveClassMetaData(Object key,
                                   Object attr)
Description copied from interface: Invocation
Resolve class level untyped metadata based on a key and the attribute of the key

Specified by:
resolveClassMetaData in interface Invocation
Returns:

getCurrentInterceptor

public int getCurrentInterceptor()

invokeNext

public Object invokeNext()
                  throws Throwable
Invoke on the next interceptor in the chain. If this is already the end of the chain, reflection will call the constructor, field, or method you are invoking on.

Specified by:
invokeNext in interface Invocation
Throws:
Throwable

invokeTarget

public Object invokeTarget()
                    throws Throwable
Invokes the target joinpoint for this invocation skipping any subsequent interceptors in the chain.

Specified by:
invokeTarget in interface Invocation
Throws:
Throwable

invokeNext

public Object invokeNext(Interceptor[] newInterceptors)
                  throws Throwable
Invoke on the next interceptor in the chain. If this is already the end of the chain, reflection will call the constructor, field, or method you are invoking on.

The Invocation will use a new set of interceptors to do the invocation

Specified by:
invokeNext in interface Invocation
Throws:
Throwable

getInterceptors

public Interceptor[] getInterceptors()
This used to be final, but I had to get rid of that since I need to lazily initialise the interceptors from the generated joinpoint/invocation classes

Specified by:
getInterceptors in interface Invocation

resolveClassAnnotation

public Object resolveClassAnnotation(Class<? extends Annotation> annotation)
Description copied from interface: Invocation
Abstraction for resolving an annotation so that it can be overriden from the Class

Specified by:
resolveClassAnnotation in interface Invocation
Returns:

resolveTypedClassAnnotation

public <T extends Annotation> T resolveTypedClassAnnotation(Class<T> annotation)
Description copied from interface: Invocation
Abstraction for resolving an annotation so that it can be overriden from the Class

Specified by:
resolveTypedClassAnnotation in interface Invocation
Returns:

resolveAnnotation

public Object resolveAnnotation(Class<? extends Annotation> annotation)
Description copied from interface: Invocation
Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.

Specified by:
resolveAnnotation in interface Invocation
Returns:

resolveTypedAnnotation

public <T extends Annotation> T resolveTypedAnnotation(Class<T> annotation)
Description copied from interface: Invocation
Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.

Specified by:
resolveTypedAnnotation in interface Invocation
Returns:

resolveAnnotation

public Object resolveAnnotation(Class<? extends Annotation>[] annotations)
Description copied from interface: Invocation
Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.

Specified by:
resolveAnnotation in interface Invocation
Returns:

resolveTypedAnnotation

public <T extends Annotation> T resolveTypedAnnotation(Class<T>[] annotations)
Description copied from interface: Invocation
Abstraction for resolving an annotation so that it can be overriden from the Method, Constructor, Field, etc.

Specified by:
resolveTypedAnnotation in interface Invocation
Returns:

getMetaData

public Object getMetaData(Object group,
                          Object attr)
This method resolves metadata based on the context of the invocation. It iterates through its list of MetaDataResolvers to find out the value of the metadata desired.

This list usually is ThreadMetaData, InstanceAdvisor.getMetaData ClassAdvisor.getMethodMetaData (or field, or constructor) ClassAdvisor.getDefaultMetaData

Specified by:
getMetaData in interface Invocation

getInstanceResolver

public MetaDataResolver getInstanceResolver()

getAdvisor

public Advisor getAdvisor()
Specified by:
getAdvisor in interface Invocation

getTargetObject

public Object getTargetObject()
Specified by:
getTargetObject in interface Invocation

setTargetObject

public void setTargetObject(Object targetObject)
Specified by:
setTargetObject in interface Invocation

setAdvisor

public void setAdvisor(Advisor advisor)

setInstanceResolver

public void setInstanceResolver(MetaDataResolver instanceResolver)


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