org.codehaus.aspectwerkz.pointcut
Class FieldPointcut

java.lang.Object
  extended byorg.codehaus.aspectwerkz.pointcut.FieldPointcut
All Implemented Interfaces:
Pointcut

public class FieldPointcut
extends java.lang.Object
implements Pointcut

Implements the pointcut concept for field access. Is an abstraction of a well defined point of execution in the program.
Could matches one or many points as long as they are well defined.
Stores the advices for this specific pointcut.

Author:
Jonas Bonér

Constructor Summary
FieldPointcut(java.lang.String pattern)
          Creates a new field pointcut.
FieldPointcut(java.lang.String uuid, java.lang.String pattern)
          Creates a new field pointcut.
 
Method Summary
 void addPointcutDef(PointcutDefinition pointcut)
          Adds a new pointcut definition.
 void addPostAdvice(java.lang.String advice)
          Adds post advice to the pointcut.
 void addPostAdvices(java.lang.String[] advicesToAdd)
          Adds post advices to the pointcut.
 void addPreAdvice(java.lang.String advice)
          Adds a pre advice to the pointcut.
 void addPreAdvices(java.lang.String[] advicesToAdd)
          Adds pre advices to the pointcut.
 java.lang.String getExpression()
          Returns the expression of the pointcut.
 int[] getPostAdviceIndexes()
          Returns a list with the indexes for the post advices for the pointcut.
 AdviceIndexTuple[] getPostAdviceIndexTuples()
          Returns the advices in the form of an array with advice/index tuples.
 java.lang.String[] getPostAdviceNames()
          Returns a list with the names for the post advices for the pointcut.
 int[] getPreAdviceIndexes()
          Returns a list with the indexes for the pre advices for the pointcut.
 AdviceIndexTuple[] getPreAdviceIndexTuples()
          Returns the advices in the form of an array with advice/index tuples.
 java.lang.String[] getPreAdviceNames()
          Returns a list with the names for the pre advices for the pointcut.
 boolean hasPostAdvice(java.lang.String advice)
          Checks if the pointcuts has a certain post advice.
 boolean hasPreAdvice(java.lang.String advice)
          Checks if the pointcuts has a certain pre advice.
 boolean matches(ClassMetaData classMetaData, FieldMetaData fieldMetaData)
          Checks if the pointcut matches a certain join point.
static boolean matchFieldPointcutSuperClasses(org.apache.commons.jexl.JexlContext jexlContext, java.lang.String name, ClassMetaData classMetaData, FieldMetaData fieldMetaData, PointcutPatternTuple pointcutPattern)
          Tries to finds a match at some superclass in the hierarchy.
static boolean matchFieldPointcutSuperClasses(org.apache.commons.jexl.JexlContext jexlContext, java.lang.String name, ClassMetaData classMetaData, PointcutPatternTuple pointcutPattern)
          Tries to finds a match at some superclass in the hierarchy.
 void removePostAdvice(java.lang.String advice)
          Removes a post advice from the pointcut.
 void removePreAdvice(java.lang.String advice)
          Removes a pre advice from the pointcut.
 void setPostAdviceIndexTuples(AdviceIndexTuple[] tuple)
          Sets the advices.
 void setPostAdvices(int[] indexes, java.lang.String[] names)
          Sets the post advices.
 void setPreAdviceIndexTuples(AdviceIndexTuple[] tuple)
          Sets the advices.
 void setPreAdvices(int[] indexes, java.lang.String[] names)
          Sets the pre advices.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldPointcut

public FieldPointcut(java.lang.String pattern)
Creates a new field pointcut.

Parameters:
pattern - the pattern of the pointcut

FieldPointcut

public FieldPointcut(java.lang.String uuid,
                     java.lang.String pattern)
Creates a new field pointcut.

Parameters:
uuid - the UUID for the AspectWerkz system
pattern - the pattern for the pointcut
Method Detail

addPointcutDef

public void addPointcutDef(PointcutDefinition pointcut)
Adds a new pointcut definition.

Parameters:
pointcut - the pointcut definition

addPreAdvice

public void addPreAdvice(java.lang.String advice)
Adds a pre advice to the pointcut.

Parameters:
advice - the name of the advice to add

addPostAdvice

public void addPostAdvice(java.lang.String advice)
Adds post advice to the pointcut.

Parameters:
advice - the name of the advice to add

addPreAdvices

public void addPreAdvices(java.lang.String[] advicesToAdd)
Adds pre advices to the pointcut.

Parameters:
advicesToAdd - the advices to add

addPostAdvices

public void addPostAdvices(java.lang.String[] advicesToAdd)
Adds post advices to the pointcut.

Parameters:
advicesToAdd - the advices to add

removePreAdvice

public void removePreAdvice(java.lang.String advice)
Removes a pre advice from the pointcut.

Parameters:
advice - the name of the pre advice to remove

removePostAdvice

public void removePostAdvice(java.lang.String advice)
Removes a post advice from the pointcut.

Parameters:
advice - the name of the pre advice to remove

hasPreAdvice

public boolean hasPreAdvice(java.lang.String advice)
Checks if the pointcuts has a certain pre advice.

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

hasPostAdvice

public boolean hasPostAdvice(java.lang.String advice)
Checks if the pointcuts has a certain post advice.

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

getPreAdviceIndexTuples

public AdviceIndexTuple[] getPreAdviceIndexTuples()
Returns the advices in the form of an array with advice/index tuples. To be used when a reordering of the advices is necessary.

Returns:
the current advice/index tuple array

setPreAdviceIndexTuples

public void setPreAdviceIndexTuples(AdviceIndexTuple[] tuple)
Sets the advices. To be used when a reordering of the advices is necessary.

Parameters:
tuple - the new advice/index tuple array

getPostAdviceIndexTuples

public AdviceIndexTuple[] getPostAdviceIndexTuples()
Returns the advices in the form of an array with advice/index tuples. To be used when a reordering of the advices is necessary.

Returns:
the current advice/index tuple array

setPostAdviceIndexTuples

public void setPostAdviceIndexTuples(AdviceIndexTuple[] tuple)
Sets the advices. To be used when a reordering of the advices is necessary.

Parameters:
tuple - the new advice/index tuple array

getPreAdviceIndexes

public int[] getPreAdviceIndexes()
Returns a list with the indexes for the pre advices for the pointcut.

Returns:
the pre advice indexes

getPreAdviceNames

public java.lang.String[] getPreAdviceNames()
Returns a list with the names for the pre advices for the pointcut.

Returns:
the pre advice names

getPostAdviceIndexes

public int[] getPostAdviceIndexes()
Returns a list with the indexes for the post advices for the pointcut.

Returns:
the pre advice indexes

getPostAdviceNames

public java.lang.String[] getPostAdviceNames()
Returns a list with the names for the post advices for the pointcut.

Returns:
the post advice names

getExpression

public java.lang.String getExpression()
Returns the expression of the pointcut.

Specified by:
getExpression in interface Pointcut
Returns:
the expression

setPreAdvices

public void setPreAdvices(int[] indexes,
                          java.lang.String[] names)
Sets the pre advices. Caution: the index A name arrays have to be in synch.

Parameters:
indexes - the new pre advice index array
names - the new pre advice names array

setPostAdvices

public void setPostAdvices(int[] indexes,
                           java.lang.String[] names)
Sets the post advices. Caution: the index A name arrays have to be in synch.

Parameters:
indexes - the new post advice index array
names - the new post advice names array

matches

public boolean matches(ClassMetaData classMetaData,
                       FieldMetaData fieldMetaData)
Checks if the pointcut matches a certain join point.

Parameters:
classMetaData - the class meta-data
fieldMetaData - the meta-data for the field
Returns:
boolean

matchFieldPointcutSuperClasses

public static boolean matchFieldPointcutSuperClasses(org.apache.commons.jexl.JexlContext jexlContext,
                                                     java.lang.String name,
                                                     ClassMetaData classMetaData,
                                                     PointcutPatternTuple pointcutPattern)
Tries to finds a match at some superclass in the hierarchy. Only checks for a class match to allow early filtering. Recursive.

Parameters:
jexlContext - the Jexl context
name - the name of the pointcut to evaluate
classMetaData - the class meta-data
pointcutPattern - the pointcut pattern
Returns:
boolean

matchFieldPointcutSuperClasses

public static boolean matchFieldPointcutSuperClasses(org.apache.commons.jexl.JexlContext jexlContext,
                                                     java.lang.String name,
                                                     ClassMetaData classMetaData,
                                                     FieldMetaData fieldMetaData,
                                                     PointcutPatternTuple pointcutPattern)
Tries to finds a match at some superclass in the hierarchy. Recursive.

Parameters:
jexlContext - the Jexl context
name - the name of the pointcut to evaluate
classMetaData - the class meta-data
fieldMetaData - the field meta-data
pointcutPattern - the pointcut pattern
Returns:
boolean


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