org.springframework.aop.aspectj.annotation
Class AspectMetadata

java.lang.Object
  extended by org.springframework.aop.aspectj.annotation.AspectMetadata

public class AspectMetadata
extends java.lang.Object

Metadata for an AspectJ aspect class, with an additional Spring AOP pointcut for the per clause.

Uses AspectJ 5 AJType reflection API, so is only supported on Java 5. Enables us to work with different AspectJ instantiation models such as "singleton", "pertarget" and "perthis".

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller
See Also:
AspectJExpressionPointcut

Field Summary
private  AjType ajType
          AspectJ reflection information (AspectJ 5 / Java 5 specific).
private  java.lang.String aspectName
          The name of this aspect as defined to Spring (the bean name) - allows us to determine if two pieces of advice come from the same aspect and hence their relative precedence.
private  Pointcut perClausePointcut
          Spring AOP pointcut corresponding to the per clause of the aspect.
 
Constructor Summary
AspectMetadata(java.lang.Class<?> aspectClass, java.lang.String aspectName)
          Create a new AspectMetadata instance for the given aspect class.
 
Method Summary
private  java.lang.String findPerClause(java.lang.Class<?> aspectClass)
          Extract contents from String of form pertarget(contents).
 AjType getAjType()
          Return AspectJ reflection information.
 java.lang.Class getAspectClass()
          Return the aspect class.
 java.lang.String getAspectName()
          Return the aspect class.
 Pointcut getPerClausePointcut()
          Return a Spring pointcut expression for a singleton aspect.
 boolean isLazilyInstantiated()
          Return whether the aspect needs to be lazily instantiated.
 boolean isPerThisOrPerTarget()
          Return whether the aspect is defined as "perthis" or "pertarget".
 boolean isPerTypeWithin()
          Return whether the aspect is defined as "pertypewithin".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ajType

private final AjType ajType
AspectJ reflection information (AspectJ 5 / Java 5 specific).


perClausePointcut

private final Pointcut perClausePointcut
Spring AOP pointcut corresponding to the per clause of the aspect. Will be the Pointcut.TRUE canonical instance in the case of a singleton, otherwise an AspectJExpressionPointcut.


aspectName

private java.lang.String aspectName
The name of this aspect as defined to Spring (the bean name) - allows us to determine if two pieces of advice come from the same aspect and hence their relative precedence.

Constructor Detail

AspectMetadata

public AspectMetadata(java.lang.Class<?> aspectClass,
                      java.lang.String aspectName)
Create a new AspectMetadata instance for the given aspect class.

Parameters:
aspectClass - the aspect class
aspectName - the name of the aspect
Method Detail

findPerClause

private java.lang.String findPerClause(java.lang.Class<?> aspectClass)
Extract contents from String of form pertarget(contents).


getAjType

public AjType getAjType()
Return AspectJ reflection information.


getAspectClass

public java.lang.Class getAspectClass()
Return the aspect class.


getAspectName

public java.lang.String getAspectName()
Return the aspect class.


getPerClausePointcut

public Pointcut getPerClausePointcut()
Return a Spring pointcut expression for a singleton aspect. (e.g. Pointcut.TRUE if it's a singleton).


isPerThisOrPerTarget

public boolean isPerThisOrPerTarget()
Return whether the aspect is defined as "perthis" or "pertarget".


isPerTypeWithin

public boolean isPerTypeWithin()
Return whether the aspect is defined as "pertypewithin".


isLazilyInstantiated

public boolean isLazilyInstantiated()
Return whether the aspect needs to be lazily instantiated.