Spring Framework

org.springframework.aop.support
Class ComposablePointcut

java.lang.Object
  extended by org.springframework.aop.support.ComposablePointcut
All Implemented Interfaces:
java.io.Serializable, Pointcut

public class ComposablePointcut
extends java.lang.Object
implements Pointcut, java.io.Serializable

Convenient class for building up pointcuts. All methods return ComposablePointcut, so we can use a concise idiom like: Pointcut pc = new ComposablePointcut().union(classFilter).intersection(methodMatcher).intersection(pointcut);

Since:
11.11.2003
Author:
Rod Johnson, Juergen Hoeller, Rob Harrop
See Also:
Pointcuts, Serialized Form

Field Summary
 
Fields inherited from interface org.springframework.aop.Pointcut
TRUE
 
Constructor Summary
ComposablePointcut()
          Create a default ComposablePointcut, with ClassFilter.TRUE and MethodMatcher.TRUE.
ComposablePointcut(ClassFilter classFilter)
          Create a ComposablePointcut for the given ClassFilter, with MethodMatcher.TRUE.
ComposablePointcut(ClassFilter classFilter, MethodMatcher methodMatcher)
          Create a ComposablePointcut for the given ClassFilter and MethodMatcher.
ComposablePointcut(MethodMatcher methodMatcher)
          Create a ComposablePointcut for the given MethodMatcher, with ClassFilter.TRUE.
ComposablePointcut(Pointcut pointcut)
          Create a ComposablePointcut based on the given Pointcut.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 ClassFilter getClassFilter()
          Return the ClassFilter for this pointcut.
 MethodMatcher getMethodMatcher()
          Return the MethodMatcher for this pointcut.
 int hashCode()
           
 ComposablePointcut intersection(ClassFilter other)
          Apply an intersection with the given ClassFilter.
 ComposablePointcut intersection(MethodMatcher other)
          Apply an intersection with the given MethodMatcher.
 ComposablePointcut intersection(Pointcut other)
          Apply an intersection with the given Pointcut.
 java.lang.String toString()
           
 ComposablePointcut union(ClassFilter other)
          Apply a union with the given ClassFilter.
 ComposablePointcut union(MethodMatcher other)
          Apply a union with the given MethodMatcher.
 ComposablePointcut union(Pointcut other)
          Apply a union with the given Pointcut.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComposablePointcut

public ComposablePointcut()
Create a default ComposablePointcut, with ClassFilter.TRUE and MethodMatcher.TRUE.


ComposablePointcut

public ComposablePointcut(Pointcut pointcut)
Create a ComposablePointcut based on the given Pointcut.

Parameters:
pointcut - the original Pointcut

ComposablePointcut

public ComposablePointcut(ClassFilter classFilter)
Create a ComposablePointcut for the given ClassFilter, with MethodMatcher.TRUE.

Parameters:
classFilter - the ClassFilter to use

ComposablePointcut

public ComposablePointcut(MethodMatcher methodMatcher)
Create a ComposablePointcut for the given MethodMatcher, with ClassFilter.TRUE.

Parameters:
methodMatcher - the MethodMatcher to use

ComposablePointcut

public ComposablePointcut(ClassFilter classFilter,
                          MethodMatcher methodMatcher)
Create a ComposablePointcut for the given ClassFilter and MethodMatcher.

Parameters:
classFilter - the ClassFilter to use
methodMatcher - the MethodMatcher to use
Method Detail

union

public ComposablePointcut union(ClassFilter other)
Apply a union with the given ClassFilter.

Parameters:
other - the ClassFilter to apply a union with
Returns:
this composable pointcut (for call chaining)

intersection

public ComposablePointcut intersection(ClassFilter other)
Apply an intersection with the given ClassFilter.

Parameters:
other - the ClassFilter to apply an intersection with
Returns:
this composable pointcut (for call chaining)

union

public ComposablePointcut union(MethodMatcher other)
Apply a union with the given MethodMatcher.

Parameters:
other - the MethodMatcher to apply a union with
Returns:
this composable pointcut (for call chaining)

intersection

public ComposablePointcut intersection(MethodMatcher other)
Apply an intersection with the given MethodMatcher.

Parameters:
other - the MethodMatcher to apply an intersection with
Returns:
this composable pointcut (for call chaining)

union

public ComposablePointcut union(Pointcut other)
Apply a union with the given Pointcut.

Note that for a Pointcut union, methods will only match if their original ClassFilter (from the originating Pointcut) matches as well. MethodMatchers and ClassFilters from different Pointcuts will never get interleaved with each other.

Parameters:
other - the Pointcut to apply a union with
Returns:
this composable pointcut (for call chaining)

intersection

public ComposablePointcut intersection(Pointcut other)
Apply an intersection with the given Pointcut.

Parameters:
other - the Pointcut to apply an intersection with
Returns:
this composable pointcut (for call chaining)

getClassFilter

public ClassFilter getClassFilter()
Description copied from interface: Pointcut
Return the ClassFilter for this pointcut.

Specified by:
getClassFilter in interface Pointcut
Returns:
the ClassFilter (never null)

getMethodMatcher

public MethodMatcher getMethodMatcher()
Description copied from interface: Pointcut
Return the MethodMatcher for this pointcut.

Specified by:
getMethodMatcher in interface Pointcut
Returns:
the MethodMatcher (never null)

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Spring Framework