org.mockejb.interceptor
Class MethodPatternPointcut

java.lang.Object
  extended byorg.mockejb.interceptor.MethodPatternPointcut
All Implemented Interfaces:
Pointcut

public class MethodPatternPointcut
extends java.lang.Object
implements Pointcut

Tests if the string representation of the given method matches the regexp. This pointcut uses "toString" representation of the method and then checks if it contains the regexp given to the constructor. Example of string representation: "public boolean java.lang.Object.equals(java.lang.Object)"

Author:
Alexander Ananiev

Constructor Summary
MethodPatternPointcut(java.lang.String regexpPattern)
          Creates a new instance of MethodPatternPoincut
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the given object is of the same type and it has the same pattern.
 int hashCode()
           
 boolean matchesJointpoint(java.lang.reflect.Method method)
          Tests if the string representation of the given method matches the pattern.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodPatternPointcut

public MethodPatternPointcut(java.lang.String regexpPattern)
Creates a new instance of MethodPatternPoincut

Parameters:
regexpPattern - regexp pattern that will be matched against the string representation of the method
Method Detail

matchesJointpoint

public boolean matchesJointpoint(java.lang.reflect.Method method)
Tests if the string representation of the given method matches the pattern.

Specified by:
matchesJointpoint in interface Pointcut
Parameters:
method - method being invoked
Returns:
true if the provided method should be intercepted

equals

public boolean equals(java.lang.Object obj)
Returns true if the given object is of the same type and it has the same pattern.


hashCode

public int hashCode()