Top Description Fields Constructors Methods
org.springframework.aop.support

public Class ComposablePointcut

extends Object
implements Pointcut, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.aop.Pointcut
Imports
java.io.Serializable, org.springframework.aop.ClassFilter, .MethodMatcher, .Pointcut, org.springframework.lang.Nullable, org.springframework.util.Assert

Convenient class for building up pointcuts.

All methods return ComposablePointcut, so we can use concise idioms like in the following example.

Pointcut pc = new ComposablePointcut()
                     .union(classFilter)
                     .intersection(methodMatcher)
                     .intersection(pointcut);
Authors
Rod Johnson, Juergen Hoeller, Rob Harrop
Since
11.11.2003
See Also
Pointcuts

Field Summary

Modifier and TypeField and Description
private ClassFilter
private MethodMatcher
private static final long
serialVersionUID

use serialVersionUID from Spring 1.2 for interoperability.

Constructor Summary

AccessConstructor and Description
public
ComposablePointcut()

Create a default ComposablePointcut, with ClassFilter.TRUE and MethodMatcher.TRUE.

public
ComposablePointcut(Pointcut
the original Pointcut
pointcut
)

Create a ComposablePointcut based on the given Pointcut.

public
ComposablePointcut(ClassFilter
the ClassFilter to use
classFilter
)

Create a ComposablePointcut for the given ClassFilter, with MethodMatcher.TRUE.

public
ComposablePointcut(MethodMatcher
the MethodMatcher to use
methodMatcher
)

Create a ComposablePointcut for the given MethodMatcher, with ClassFilter.TRUE.

public
ComposablePointcut(ClassFilter
the ClassFilter to use
classFilter
,
MethodMatcher
the MethodMatcher to use
methodMatcher
)

Create a ComposablePointcut for the given ClassFilter and MethodMatcher.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public ClassFilter
getClassFilter()

Implements org.springframework.aop.Pointcut.getClassFilter.

Return the ClassFilter for this pointcut.

public MethodMatcher
getMethodMatcher()

Implements org.springframework.aop.Pointcut.getMethodMatcher.

Return the MethodMatcher for this pointcut.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public ComposablePointcut

Returns:

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

Apply an intersection with the given ClassFilter.

public ComposablePointcut

Returns:

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

Apply an intersection with the given MethodMatcher.

public ComposablePointcut

Returns:

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

Apply an intersection with the given Pointcut.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public ComposablePointcut

Returns:

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

Apply a union with the given ClassFilter.

public ComposablePointcut

Returns:

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

Apply a union with the given MethodMatcher.

public ComposablePointcut

Returns:

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

Apply a union with the given Pointcut.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

classFilterback to summary
private ClassFilter classFilter
Annotations
@SuppressWarnings:serial
methodMatcherback to summary
private MethodMatcher methodMatcher
Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
private static final long serialVersionUID

use serialVersionUID from Spring 1.2 for interoperability.

Constructor Detail

ComposablePointcutback to summary
public ComposablePointcut()

Create a default ComposablePointcut, with ClassFilter.TRUE and MethodMatcher.TRUE.

ComposablePointcutback to summary
public ComposablePointcut(Pointcut pointcut)

Create a ComposablePointcut based on the given Pointcut.

Parameters
pointcut:Pointcut

the original Pointcut

ComposablePointcutback to summary
public ComposablePointcut(ClassFilter classFilter)

Create a ComposablePointcut for the given ClassFilter, with MethodMatcher.TRUE.

Parameters
classFilter:ClassFilter

the ClassFilter to use

ComposablePointcutback to summary
public ComposablePointcut(MethodMatcher methodMatcher)

Create a ComposablePointcut for the given MethodMatcher, with ClassFilter.TRUE.

Parameters
methodMatcher:MethodMatcher

the MethodMatcher to use

ComposablePointcutback to summary
public ComposablePointcut(ClassFilter classFilter, MethodMatcher methodMatcher)

Create a ComposablePointcut for the given ClassFilter and MethodMatcher.

Parameters
classFilter:ClassFilter

the ClassFilter to use

methodMatcher:MethodMatcher

the MethodMatcher to use

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getClassFilterback to summary
public ClassFilter getClassFilter()

Implements org.springframework.aop.Pointcut.getClassFilter.

Doc from org.springframework.aop.Pointcut.getClassFilter.

Return the ClassFilter for this pointcut.

Returns:ClassFilter

the ClassFilter (never null)

Annotations
@Override
getMethodMatcherback to summary
public MethodMatcher getMethodMatcher()

Implements org.springframework.aop.Pointcut.getMethodMatcher.

Doc from org.springframework.aop.Pointcut.getMethodMatcher.

Return the MethodMatcher for this pointcut.

Returns:MethodMatcher

the MethodMatcher (never null)

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
intersectionback to summary
public ComposablePointcut intersection(ClassFilter other)

Apply an intersection with the given ClassFilter.

Parameters
other:ClassFilter

the ClassFilter to apply an intersection with

Returns:ComposablePointcut

this composable pointcut (for call chaining)

intersectionback to summary
public ComposablePointcut intersection(MethodMatcher other)

Apply an intersection with the given MethodMatcher.

Parameters
other:MethodMatcher

the MethodMatcher to apply an intersection with

Returns:ComposablePointcut

this composable pointcut (for call chaining)

intersectionback to summary
public ComposablePointcut intersection(Pointcut other)

Apply an intersection with the given Pointcut.

Parameters
other:Pointcut

the Pointcut to apply an intersection with

Returns:ComposablePointcut

this composable pointcut (for call chaining)

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
unionback to summary
public ComposablePointcut union(ClassFilter other)

Apply a union with the given ClassFilter.

Parameters
other:ClassFilter

the ClassFilter to apply a union with

Returns:ComposablePointcut

this composable pointcut (for call chaining)

unionback to summary
public ComposablePointcut union(MethodMatcher other)

Apply a union with the given MethodMatcher.

Parameters
other:MethodMatcher

the MethodMatcher to apply a union with

Returns:ComposablePointcut

this composable pointcut (for call chaining)

unionback to summary
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:Pointcut

the Pointcut to apply a union with

Returns:ComposablePointcut

this composable pointcut (for call chaining)