org.codehaus.aspectwerkz.aspect
Class IntroductionContainer

java.lang.Object
  extended byorg.codehaus.aspectwerkz.aspect.IntroductionContainer

public class IntroductionContainer
extends Object

Container for Introductions.

Author:
Alexandre Vasseur , Jonas Bonér

Field Summary
protected  AspectContainer m_definingAspectContainer
          The aspect container for the introduction.
protected  Method[] m_methodRepository
          The methods repository.
protected  Map m_perClass
          Holds references to the per class introductions.
protected  Map m_perInstance
          Holds references to the per instance introductions.
protected  Introduction m_perJvm
          Holds a reference to the sole per JVM introduction.
protected  Map m_perThread
          Holds references to the per thread introductions.
protected  Introduction m_prototype
          The introduction prototype.
 
Constructor Summary
IntroductionContainer(Introduction prototype, AspectContainer definingAspectContainer)
          Creates a new container strategy.
 
Method Summary
 Class getTargetClass(Object mixinImpl)
          Returns the target class from an introduction
 Object getTargetInstance(Object mixinImpl)
          Returns the target instance from an introduction
 Object invokeIntroductionPerClass(Object targetInstance, int methodIndex, Object[] parameters)
          Invokes the method on a per class basis.
 Object invokeIntroductionPerInstance(Object targetInstance, int methodIndex, Object[] parameters)
          Invokes the method on a per instance basis.
 Object invokeIntroductionPerJvm(int methodIndex, Object[] parameters)
          Invokes the method on a per JVM basis.
 Object invokeIntroductionPerThread(int methodIndex, Object[] parameters)
          Invokes the method on a per thread basis.
 void swapImplementation(Class newImplementationClass)
          Swaps the current mixin implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_perJvm

protected Introduction m_perJvm
Holds a reference to the sole per JVM introduction.


m_perClass

protected Map m_perClass
Holds references to the per class introductions.


m_perInstance

protected Map m_perInstance
Holds references to the per instance introductions.


m_perThread

protected Map m_perThread
Holds references to the per thread introductions.


m_prototype

protected Introduction m_prototype
The introduction prototype.


m_methodRepository

protected Method[] m_methodRepository
The methods repository.


m_definingAspectContainer

protected AspectContainer m_definingAspectContainer
The aspect container for the introduction.

Constructor Detail

IntroductionContainer

public IntroductionContainer(Introduction prototype,
                             AspectContainer definingAspectContainer)
Creates a new container strategy.

Parameters:
definingAspectContainer - the aspect container
Method Detail

invokeIntroductionPerJvm

public Object invokeIntroductionPerJvm(int methodIndex,
                                       Object[] parameters)
                                throws Throwable
Invokes the method on a per JVM basis.

Parameters:
methodIndex - the method index
parameters - the parameters for the invocation
Returns:
the result from the method invocation
Throws:
Throwable

invokeIntroductionPerClass

public Object invokeIntroductionPerClass(Object targetInstance,
                                         int methodIndex,
                                         Object[] parameters)
                                  throws Throwable
Invokes the method on a per class basis.

Parameters:
targetInstance - a reference to the calling object
methodIndex - the method index
parameters - the parameters for the invocation
Returns:
the result from the method invocation
Throws:
Throwable

invokeIntroductionPerInstance

public Object invokeIntroductionPerInstance(Object targetInstance,
                                            int methodIndex,
                                            Object[] parameters)
                                     throws Throwable
Invokes the method on a per instance basis.

Parameters:
targetInstance - a reference to the target instance
methodIndex - the method index
parameters - the parameters for the invocation
Returns:
the result from the method invocation
Throws:
Throwable

invokeIntroductionPerThread

public Object invokeIntroductionPerThread(int methodIndex,
                                          Object[] parameters)
                                   throws Throwable
Invokes the method on a per thread basis.

Parameters:
methodIndex - the method index
parameters - the parameters for the invocation
Returns:
the result from the method invocation
Throws:
Throwable

swapImplementation

public void swapImplementation(Class newImplementationClass)
Swaps the current mixin implementation.

Parameters:
newImplementationClass - the class of the new implementation to use

getTargetInstance

public Object getTargetInstance(Object mixinImpl)
Returns the target instance from an introduction

Parameters:
mixinImpl - aka "this" from the mixin impl
Returns:
the target instance or null (if not perInstance deployed mixin)

getTargetClass

public Class getTargetClass(Object mixinImpl)
Returns the target class from an introduction

Parameters:
mixinImpl - aka "this" from the mixin impl
Returns:
the target instance or null (if not perInstance or perClas deployed mixin)


Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.