org.codehaus.aspectwerkz.attribdef.aspect
Class DefaultIntroductionContainerStrategy

java.lang.Object
  extended byorg.codehaus.aspectwerkz.attribdef.aspect.DefaultIntroductionContainerStrategy
All Implemented Interfaces:
IntroductionContainer

public class DefaultIntroductionContainerStrategy
extends java.lang.Object
implements IntroductionContainer

Container for Introductions.

Author:
Alexandre Vasseur

Constructor Summary
DefaultIntroductionContainerStrategy(Introduction prototype, AspectContainer definingAspectContainer)
          Creates a new container strategy.
 
Method Summary
 java.lang.Class getTargetClass(java.lang.Object mixinImpl)
          Returns the target class from an introduction
 java.lang.Object getTargetInstance(java.lang.Object mixinImpl)
          Returns the target instance from an introduction
 java.lang.Object invokeIntroductionPerClass(java.lang.Object targetInstance, int methodIndex, java.lang.Object[] parameters)
          Invokes the method on a per class basis.
 java.lang.Object invokeIntroductionPerInstance(java.lang.Object targetInstance, int methodIndex, java.lang.Object[] parameters)
          Invokes the method on a per instance basis.
 java.lang.Object invokeIntroductionPerJvm(int methodIndex, java.lang.Object[] parameters)
          Invokes the method on a per JVM basis.
 java.lang.Object invokeIntroductionPerThread(int methodIndex, java.lang.Object[] parameters)
          Invokes the method on a per thread basis.
 void swapImplementation(java.lang.Class newImplementationClass)
          Swaps the current mixin implementation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIntroductionContainerStrategy

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

Parameters:
prototype - the advice prototype
Method Detail

invokeIntroductionPerJvm

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

Specified by:
invokeIntroductionPerJvm in interface IntroductionContainer
Parameters:
methodIndex - the method index
parameters - the parameters for the invocation
Returns:
the result from the method invocation

invokeIntroductionPerClass

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

Specified by:
invokeIntroductionPerClass in interface IntroductionContainer
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

invokeIntroductionPerInstance

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

Specified by:
invokeIntroductionPerInstance in interface IntroductionContainer
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

invokeIntroductionPerThread

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

Specified by:
invokeIntroductionPerThread in interface IntroductionContainer
Parameters:
methodIndex - the method index
parameters - the parameters for the invocation
Returns:
the result from the method invocation

swapImplementation

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

Specified by:
swapImplementation in interface IntroductionContainer
Parameters:
newImplementationClass - the class of the new implementation to use

getTargetInstance

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

Specified by:
getTargetInstance in interface IntroductionContainer
Parameters:
mixinImpl - aka "this" from the mixin impl
Returns:
the target instance or null (if not perInstance deployed mixin)

getTargetClass

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

Specified by:
getTargetClass in interface IntroductionContainer
Parameters:
mixinImpl - aka "this" from the mixin impl
Returns:
the target instance or null (if not perInstance or perClas deployed mixin)


Copyright (c) 2002-2004 The AspectWerkz Team. All Rights Reserved.