com.lonniepryor.blues.aop
Class Pointcut

java.lang.Object
  |
  +--com.lonniepryor.blues.aop.Pointcut

public abstract class Pointcut
extends java.lang.Object

Specification interface for identifying JoinPoints. Instances of this class may be logically combined using the AND, OR, and NOT operations. Many common use-cases are supplied via static accessor methods.

Version:
$Revision: 1.1 $
Author:
Lonnie Pryor

Constructor Summary
protected Pointcut()
          Creates a new Pointcut object.
 
Method Summary
 Pointcut and(Pointcut specification)
          Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right.
protected abstract  boolean evaluate(Aspect aspect, JoinPoint joinPoint)
          Returns true if the supplied join point satisfies this pointcut.
static Pointcut invokeInstance(Strings specification)
          Creates a new specification satisified by join points whose instance name satisfy the supplied specification.
static Pointcut invokeMethod(Methods specification)
          Creates a new specification satisified by join points whose target method satisfy the supplied specification.
 boolean isSatisfiedBy(Aspect aspect, JoinPoint joinPoint)
          Returns true if the parameters are not null and the supplied join point satisfies this pointcut.
 Pointcut not()
          Returns a specification representing a logical NOT of this specification.
 Pointcut or(Pointcut specification)
          Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right.
static Pointcut parse(java.lang.String pointcutPattern)
          Parses a pattern consisting of a pointcut declaration.
static Pointcut parseExpression(java.lang.String pointcutPatternExpr)
          Parses a logical expression as described in the Expression class, using this class's parse() method for creating values.
static Pointcut refrence(java.lang.String poincutName)
          Creates a new specification satisified by join points that satisfy the named pointcut.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pointcut

protected Pointcut()
Creates a new Pointcut object.

Method Detail

invokeInstance

public static Pointcut invokeInstance(Strings specification)
Creates a new specification satisified by join points whose instance name satisfy the supplied specification.

Parameters:
specification - The specification to test instance names with.
Returns:
A new specification satisified by join points whose instance name satisfy the supplied specification.

invokeMethod

public static Pointcut invokeMethod(Methods specification)
Creates a new specification satisified by join points whose target method satisfy the supplied specification.

Parameters:
specification - The specification to test target methods with.
Returns:
A new specification satisified by join points whose target method satisfy the supplied specification.

refrence

public static Pointcut refrence(java.lang.String poincutName)
Creates a new specification satisified by join points that satisfy the named pointcut.

Parameters:
poincutName - The name of the pointcut to evaluate.
Returns:
A new specification satisified by join points that satisfy the named pointcut.

parse

public static Pointcut parse(java.lang.String pointcutPattern)
Parses a pattern consisting of a pointcut declaration. Format:
    pointcut         ::=  invoke-pointcut | named-pointcut
    invoke-pointcut  ::=  "invoke" "(" invoke-params ")"
    invoke-params    ::=  [ "[" instance-pattern "]" ] method-pattern.
    instance-pattern ::=  A '/'-delimeted TokenizedStrings pattern expression.
    method-pattern   ::=  A Methods pattern.
    named-pointcut   ::=  name "(" ")"
    name             ::=  Any valid Java name except "invoke".
 
Example:
   invoke([aService || anotherService] void *(int, ..))
 
The above creates a specification satisified by join points on instances named 'aService' or 'anotherService', with a target method that returns void and takes an int as its first parameter.

Parameters:
pointcutPattern - The pattern definition string.
Returns:
A specification matching the pattern.
Throws:
ParseException - if the pattern is invalid.
See Also:
Methods.parse(String), TokenizedStrings.parseExpression(String, char)

parseExpression

public static Pointcut parseExpression(java.lang.String pointcutPatternExpr)
Parses a logical expression as described in the Expression class, using this class's parse() method for creating values.

Parameters:
pointcutPatternExpr - The pattern expression definition string.
Returns:
A specification matching the pattern expression.
Throws:
ParseException - if the pattern expression is invalid.
See Also:
Expression, parse(String)

isSatisfiedBy

public final boolean isSatisfiedBy(Aspect aspect,
                                   JoinPoint joinPoint)
Returns true if the parameters are not null and the supplied join point satisfies this pointcut.

Parameters:
aspect - The aspect to lookup refrenced pointcuts on.
joinPoint - The join point to evaluate.
Returns:
True if the parameters are not null and the supplied join point satisfies this pointcut.

evaluate

protected abstract boolean evaluate(Aspect aspect,
                                    JoinPoint joinPoint)
Returns true if the supplied join point satisfies this pointcut.

Parameters:
aspect - The aspect to lookup refrenced pointcuts on.
joinPoint - The join point to evaluate.
Returns:
True if the supplied join point satisfies this pointcut.

and

public final Pointcut and(Pointcut specification)
Returns a specification representing a logical AND of this specification on the left and the supplied specification on the right.

Parameters:
specification - The specification to AND with.
Returns:
A specification representing a logical AND of this specification on the left and the supplied specification on the right.

or

public final Pointcut or(Pointcut specification)
Returns a specification representing a logical OR of this specification on the left and the supplied specification on the right.

Parameters:
specification - The specification to OR with.
Returns:
A specification representing a logical OR of this specification on the left and the supplied specification on the right.

not

public final Pointcut not()
Returns a specification representing a logical NOT of this specification.

Returns:
A specification representing a logical NOT of this specification.


Copyright © 2003 Blues Framework. All Rights Reserved.