org.codehaus.aspectwerkz.aspect.management
Class Pointcut

java.lang.Object
  extended byorg.codehaus.aspectwerkz.aspect.management.Pointcut
All Implemented Interfaces:
Serializable

public class Pointcut
extends Object
implements Serializable

Implementation of the pointcut concept. I.e. an abstraction of a well defined point of execution in the program.

Could matches one or many as long at it is well defined.
Stores the advices for the specific pointcut.

Author:
Jonas Bonér , Alexandre Vasseur TODO this class has transient fields that might cause pbms after serialization TODO change addXXAdvice to allow 'aspectName, adviceName' params
See Also:
Serialized Form

Field Summary
protected  AdviceInfo[] m_afterFinallyAdviceIndexes
          The indexes of the after finally advices.
protected  String[] m_afterFinallyAdviceNames
          The names of the after finally advices.
protected  AdviceInfo[] m_afterReturningAdviceIndexes
          The indexes of the after returning advices.
protected  String[] m_afterReturningAdviceNames
          The names of the after returning advices.
protected  AdviceInfo[] m_afterThrowingAdviceIndexes
          The indexes of the after throwing advices.
protected  String[] m_afterThrowingAdviceNames
          The names of the after throwing advices.
protected  AdviceInfo[] m_aroundAdviceIndexes
          The indexes of the around advices.
protected  String[] m_aroundAdviceNames
          The names of the around advices.
protected  AspectManager m_aspectManager
          The AspectManager for the AspectWerkz system.
protected  AdviceInfo[] m_beforeAdviceIndexes
          The indexes of the before advices.
protected  String[] m_beforeAdviceNames
          The names of the around advices.
protected  ExpressionInfo m_expressionInfo
          The expression for the pointcut.
 
Constructor Summary
Pointcut(AspectManager aspectManager, ExpressionInfo expressionInfo)
          Creates a new pointcut.
 
Method Summary
 void addAfterFinallyAdvices(String advice)
          Adds an after finally advice to the pointcut.
 void addAfterReturningAdvices(String advice)
          Adds an after returning advice to the pointcut.
 void addAfterThrowingAdvices(String advice)
          Adds an after throwing advice to the pointcut.
 void addAroundAdvice(String advice)
          Adds an around advice to the pointcut.
 void addBeforeAdvice(String advice)
          Adds a before advice to the pointcut.
 AdviceInfo getAfterAdviceIndex(int index)
          Returns a specific advice index.
 List getAfterAdviceIndexTuples()
          Returns the advices in the form of an array with advice/index tuples.
 AdviceInfo[] getAfterFinallyAdviceIndexes()
          Returns a list with the indexes for the after advices for the pointcut.
 String getAfterFinallyAdviceName(int index)
          Returns the after advice name at the given index
 AdviceInfo[] getAfterReturningAdviceIndexes()
          Returns a list with the indexes for the after advices for the pointcut.
 String getAfterReturningAdviceName(int index)
          Returns the after advice name at the given index
 AdviceInfo[] getAfterThrowingAdviceIndexes()
          Returns a list with the indexes for the after advices for the pointcut.
 String getAfterThrowingAdviceName(int index)
          Returns the after advice name at the given index
 AdviceInfo getAroundAdviceIndex(int index)
          Returns a specific advice index.
 AdviceInfo[] getAroundAdviceIndexes()
          Returns a list with the indexes for the around advices for the pointcut.
 List getAroundAdviceIndexTuples()
          Returns the advices in the form of an array with advice/index tuples.
 String getAroundAdviceName(int index)
          Returns the around advice name at the given index.
 AspectManager getAspectManager()
          Returns the aspect manager.
 AdviceInfo getBeforeAdviceIndex(int index)
          Returns a specific advice index.
 AdviceInfo[] getBeforeAdviceIndexes()
          Returns a list with the indexes for the before advices for the pointcut.
 List getBeforeAdviceIndexTuples()
          Returns the advices in the form of an array with advice/index tuples.
 String getBeforeAdviceName(int index)
          Returns the before advice name at the given index
 ExpressionInfo getExpressionInfo()
          Returns the expression for the pointcut.
 boolean hasAfterAdvice(String advice)
          Checks if the pointcuts has a certain advice.
 boolean hasAroundAdvice(String advice)
          Checks if the pointcuts has a certain advice.
 boolean hasBeforeAdvice(String advice)
          Checks if the pointcuts has a certain advice.
 void removeAfterAdvice(String advice)
          Removes an advice from the pointcut.
 void removeAroundAdvice(String advice)
          Removes an advice from the pointcut.
 void removeBeforeAdvice(String advice)
          Removes an advice from the pointcut.
 void setAfterAdviceIndexTuples(List advices)
          Sets the advices.
 void setAroundAdviceIndexTuples(List advices)
          Sets the advices.
 void setBeforeAdviceIndexTuples(List advices)
          Sets the advices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_expressionInfo

protected transient ExpressionInfo m_expressionInfo
The expression for the pointcut.


m_aroundAdviceNames

protected String[] m_aroundAdviceNames
The names of the around advices.


m_beforeAdviceNames

protected String[] m_beforeAdviceNames
The names of the around advices.


m_afterFinallyAdviceNames

protected String[] m_afterFinallyAdviceNames
The names of the after finally advices.


m_afterReturningAdviceNames

protected String[] m_afterReturningAdviceNames
The names of the after returning advices.


m_afterThrowingAdviceNames

protected String[] m_afterThrowingAdviceNames
The names of the after throwing advices.


m_aroundAdviceIndexes

protected AdviceInfo[] m_aroundAdviceIndexes
The indexes of the around advices.


m_beforeAdviceIndexes

protected AdviceInfo[] m_beforeAdviceIndexes
The indexes of the before advices.


m_afterFinallyAdviceIndexes

protected AdviceInfo[] m_afterFinallyAdviceIndexes
The indexes of the after finally advices.


m_afterReturningAdviceIndexes

protected AdviceInfo[] m_afterReturningAdviceIndexes
The indexes of the after returning advices.


m_afterThrowingAdviceIndexes

protected AdviceInfo[] m_afterThrowingAdviceIndexes
The indexes of the after throwing advices.


m_aspectManager

protected final transient AspectManager m_aspectManager
The AspectManager for the AspectWerkz system. TODO if the manager is needed after serialization it can be rebuild using UUID, see AdviceInfo.java

Constructor Detail

Pointcut

public Pointcut(AspectManager aspectManager,
                ExpressionInfo expressionInfo)
Creates a new pointcut.

Parameters:
aspectManager - the aspectManager for the AspectWerkz system
expressionInfo - the pattern for the pointcut
Method Detail

addAroundAdvice

public void addAroundAdvice(String advice)
Adds an around advice to the pointcut.

Parameters:
advice - the name of the advice to add

addBeforeAdvice

public void addBeforeAdvice(String advice)
Adds a before advice to the pointcut.

Parameters:
advice - the name of the advice to add

addAfterFinallyAdvices

public void addAfterFinallyAdvices(String advice)
Adds an after finally advice to the pointcut.

Parameters:
advice - the name of the advice to add

addAfterReturningAdvices

public void addAfterReturningAdvices(String advice)
Adds an after returning advice to the pointcut.

Parameters:
advice - the name of the advice to add

addAfterThrowingAdvices

public void addAfterThrowingAdvices(String advice)
Adds an after throwing advice to the pointcut.

Parameters:
advice - the name of the advice to add

removeAroundAdvice

public void removeAroundAdvice(String advice)
Removes an advice from the pointcut.

Parameters:
advice - the name of the advice to remove

removeBeforeAdvice

public void removeBeforeAdvice(String advice)
Removes an advice from the pointcut.

Parameters:
advice - the name of the advice to remove

removeAfterAdvice

public void removeAfterAdvice(String advice)
Removes an advice from the pointcut.

Parameters:
advice - the name of the advice to remove

hasAroundAdvice

public boolean hasAroundAdvice(String advice)
Checks if the pointcuts has a certain advice.

Parameters:
advice - the advice to check for existence
Returns:
boolean

hasBeforeAdvice

public boolean hasBeforeAdvice(String advice)
Checks if the pointcuts has a certain advice.

Parameters:
advice - the advice to check for existence
Returns:
boolean

hasAfterAdvice

public boolean hasAfterAdvice(String advice)
Checks if the pointcuts has a certain advice.

Parameters:
advice - the advice to check for existence
Returns:
boolean

getAroundAdviceIndexTuples

public List getAroundAdviceIndexTuples()
Returns the advices in the form of an array with advice/index tuples. To be used when a reordering of the advices is necessary.
For addition of an advice see addAdviceTestMethod(..).
For removal of an advice see removeAdviceTestMethod(..).

Returns:
the current advice/index tuples as a list

getBeforeAdviceIndexTuples

public List getBeforeAdviceIndexTuples()
Returns the advices in the form of an array with advice/index tuples. To be used when a reordering of the advices is necessary.
For addition of an advice see addAdviceTestMethod(..).
For removal of an advice see removeAdviceTestMethod(..).

Returns:
the current advice/index tuples as a list

getAfterAdviceIndexTuples

public List getAfterAdviceIndexTuples()
Returns the advices in the form of an array with advice/index tuples. To be used when a reordering of the advices is necessary.
For addition of an advice see addAdviceTestMethod(..).
For removal of an advice see removeAdviceTestMethod(..).

Returns:
the current advice/index tuples as a list

setAroundAdviceIndexTuples

public void setAroundAdviceIndexTuples(List advices)
Sets the advices. To be used when a reordering of the advices is necessary.
For addition of an advice see addAdviceTestMethod(..).
For removal of an advice see removeAdviceTestMethod(..).

Parameters:
advices - the new advice/index tuple array

setBeforeAdviceIndexTuples

public void setBeforeAdviceIndexTuples(List advices)
Sets the advices. To be used when a reordering of the advices is necessary.
For addition of an advice see addAdviceTestMethod(..).
For removal of an advice see removeAdviceTestMethod(..).

Parameters:
advices - the new advice/index tuple array

setAfterAdviceIndexTuples

public void setAfterAdviceIndexTuples(List advices)
Sets the advices. To be used when a reordering of the advices is necessary.
For addition of an advice see addAdviceTestMethod(..).
For removal of an advice see removeAdviceTestMethod(..).

Parameters:
advices - the new advice/index tuple array

getAroundAdviceName

public String getAroundAdviceName(int index)
Returns the around advice name at the given index.

Returns:
the advice name

getAroundAdviceIndex

public AdviceInfo getAroundAdviceIndex(int index)
Returns a specific advice index.

Returns:
the advice index

getBeforeAdviceIndex

public AdviceInfo getBeforeAdviceIndex(int index)
Returns a specific advice index.

Returns:
the advice index

getAfterAdviceIndex

public AdviceInfo getAfterAdviceIndex(int index)
Returns a specific advice index.

Returns:
the advice index

getAroundAdviceIndexes

public AdviceInfo[] getAroundAdviceIndexes()
Returns a list with the indexes for the around advices for the pointcut.

Returns:
the advices

getBeforeAdviceIndexes

public AdviceInfo[] getBeforeAdviceIndexes()
Returns a list with the indexes for the before advices for the pointcut.

Returns:
the advices

getBeforeAdviceName

public String getBeforeAdviceName(int index)
Returns the before advice name at the given index

Returns:
the advice name

getAfterFinallyAdviceIndexes

public AdviceInfo[] getAfterFinallyAdviceIndexes()
Returns a list with the indexes for the after advices for the pointcut.

Returns:
the advices

getAfterReturningAdviceIndexes

public AdviceInfo[] getAfterReturningAdviceIndexes()
Returns a list with the indexes for the after advices for the pointcut.

Returns:
the advices

getAfterThrowingAdviceIndexes

public AdviceInfo[] getAfterThrowingAdviceIndexes()
Returns a list with the indexes for the after advices for the pointcut.

Returns:
the advices

getAfterFinallyAdviceName

public String getAfterFinallyAdviceName(int index)
Returns the after advice name at the given index

Returns:
the advice name

getAfterReturningAdviceName

public String getAfterReturningAdviceName(int index)
Returns the after advice name at the given index

Returns:
the advice name

getAfterThrowingAdviceName

public String getAfterThrowingAdviceName(int index)
Returns the after advice name at the given index

Returns:
the advice name

getExpressionInfo

public ExpressionInfo getExpressionInfo()
Returns the expression for the pointcut.

Returns:
the expression

getAspectManager

public AspectManager getAspectManager()
Returns the aspect manager.

Returns:
the aspect manager


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