org.codehaus.aspectwerkz.attribdef.aspect
Class DefaultAspectContainerStrategy

java.lang.Object
  extended byorg.codehaus.aspectwerkz.attribdef.aspect.DefaultAspectContainerStrategy
All Implemented Interfaces:
AspectContainer

public class DefaultAspectContainerStrategy
extends java.lang.Object
implements AspectContainer

Implements the default aspect container strategy.

Author:
Jonas Bonér

Constructor Summary
DefaultAspectContainerStrategy(Aspect prototype)
          Creates a new transient container strategy.
 
Method Summary
 void addIntroductionContainer(java.lang.String name, IntroductionContainer introContainer)
          Attach the introduction container to this aspect container to mirror the "aspect contains 0-n introduction"
 ContainerType getContainerType()
          Returns the container type.
 IntroductionContainer getIntroductionContainer(java.lang.String name)
          Returns the introduction container of given name (introduction name) or null if not linked.
 java.lang.reflect.Method getMethod(int index)
          Returns a specific method by the method index.
 Aspect getPerClassAspect(java.lang.Class callingClass)
          Returns the aspect for the current class.
 Aspect getPerInstanceAspect(java.lang.Object callingInstance)
          Returns the aspect for the current instance.
 Aspect getPerJvmAspect()
          Returns the sole per JVM aspect.
 Aspect getPerThreadAspect()
          Returns the aspect for the current thread.
 java.lang.Object invokeAdvicePerClass(int methodIndex, JoinPoint joinPoint)
          Invokes the advice method on a per class basis.
 java.lang.Object invokeAdvicePerInstance(int methodIndex, JoinPoint joinPoint)
          Invokes the advice method on a per instance basis.
 java.lang.Object invokeAdvicePerJvm(int methodIndex, JoinPoint joinPoint)
          Invokes the advice method on a per JVM basis.
 java.lang.Object invokeAdvicePerThread(int methodIndex, JoinPoint joinPoint)
          Invokes the advice method on a per thread basis.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAspectContainerStrategy

public DefaultAspectContainerStrategy(Aspect prototype)
Creates a new transient container strategy.

Parameters:
prototype - the advice prototype
Method Detail

invokeAdvicePerJvm

public java.lang.Object invokeAdvicePerJvm(int methodIndex,
                                           JoinPoint joinPoint)
Invokes the advice method on a per JVM basis.

Specified by:
invokeAdvicePerJvm in interface AspectContainer
Parameters:
methodIndex - the method index
joinPoint - the join point
Returns:
the result from the method invocation

invokeAdvicePerClass

public java.lang.Object invokeAdvicePerClass(int methodIndex,
                                             JoinPoint joinPoint)
Invokes the advice method on a per class basis.

Specified by:
invokeAdvicePerClass in interface AspectContainer
Parameters:
methodIndex - the method index
joinPoint - the join point
Returns:
the result from the method invocation

invokeAdvicePerInstance

public java.lang.Object invokeAdvicePerInstance(int methodIndex,
                                                JoinPoint joinPoint)
Invokes the advice method on a per instance basis.

Specified by:
invokeAdvicePerInstance in interface AspectContainer
Parameters:
methodIndex - the method index
joinPoint - the join point
Returns:
the result from the method invocation

invokeAdvicePerThread

public java.lang.Object invokeAdvicePerThread(int methodIndex,
                                              JoinPoint joinPoint)
Invokes the advice method on a per thread basis.

Specified by:
invokeAdvicePerThread in interface AspectContainer
Parameters:
methodIndex - the method index
joinPoint - the join point
Returns:
the result from the method invocation

getContainerType

public ContainerType getContainerType()
Returns the container type.

Specified by:
getContainerType in interface AspectContainer
Returns:
the container type

getMethod

public java.lang.reflect.Method getMethod(int index)
Returns a specific method by the method index.

Specified by:
getMethod in interface AspectContainer
Parameters:
index - the method index
Returns:
the method

getPerJvmAspect

public Aspect getPerJvmAspect()
Returns the sole per JVM aspect.

Specified by:
getPerJvmAspect in interface AspectContainer
Returns:
the aspect

getPerClassAspect

public Aspect getPerClassAspect(java.lang.Class callingClass)
Returns the aspect for the current class.

Specified by:
getPerClassAspect in interface AspectContainer
Parameters:
callingClass -
Returns:
the aspect

getPerInstanceAspect

public Aspect getPerInstanceAspect(java.lang.Object callingInstance)
Returns the aspect for the current instance.

Specified by:
getPerInstanceAspect in interface AspectContainer
Parameters:
callingInstance -
Returns:
the aspect

getPerThreadAspect

public Aspect getPerThreadAspect()
Returns the aspect for the current thread.

Specified by:
getPerThreadAspect in interface AspectContainer
Returns:
the aspect

addIntroductionContainer

public void addIntroductionContainer(java.lang.String name,
                                     IntroductionContainer introContainer)
Attach the introduction container to this aspect container to mirror the "aspect contains 0-n introduction"

Specified by:
addIntroductionContainer in interface AspectContainer
Parameters:
name - of the introduction
introContainer - introduction container

getIntroductionContainer

public IntroductionContainer getIntroductionContainer(java.lang.String name)
Returns the introduction container of given name (introduction name) or null if not linked.

Specified by:
getIntroductionContainer in interface AspectContainer
Parameters:
name - of the introduction
Returns:
introduction container


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