org.mockejb.interceptor
Class ClassPointcut

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

public class ClassPointcut
extends java.lang.Object
implements Pointcut

Tests if the given class matches the class provided to the constructor of ClassPointcut.

Author:
Alexander Ananiev

Constructor Summary
ClassPointcut(java.lang.Class clazz)
          Creates a new instance of ClassPoincut It will not match subclasses.
ClassPointcut(java.lang.Class clazz, boolean matchSubclasses)
          Creates a new instance of ClassPoincut
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the given object is of type ClassPointcut and it handles the same class and handlesSubclasses flag is set to the same value
 int hashCode()
           
 boolean matchesJointpoint(java.lang.reflect.Method method)
          Tests if the class of the provided method is the same with the the class provided to the constructor of this pointcut.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassPointcut

public ClassPointcut(java.lang.Class clazz)
Creates a new instance of ClassPoincut It will not match subclasses.

Parameters:
clazz - class to match

ClassPointcut

public ClassPointcut(java.lang.Class clazz,
                     boolean matchSubclasses)
Creates a new instance of ClassPoincut

Parameters:
clazz - class to match
matchSubclasses - if true, the pointcut will also match all subclasses/ subinterfaces of the provided class.
Method Detail

matchesJointpoint

public boolean matchesJointpoint(java.lang.reflect.Method method)
Tests if the class of the provided method is the same with the the class provided to the constructor of this pointcut. Note that it uses class equality, not instanceof.

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 type ClassPointcut and it handles the same class and handlesSubclasses flag is set to the same value


hashCode

public int hashCode()