Examples of ClassFilter


Examples of org.springframework.aop.ClassFilter

   * @param typePattern type pattern the introduction is restricted to
   * @param defaultImpl default implementation class
   */
  public DeclareParentsAdvisor(Class interfaceType, String typePattern, Class defaultImpl) {
    this.introducedInterface = interfaceType;
    ClassFilter typePatternFilter = new TypePatternClassFilter(typePattern);

    // Excludes methods implemented.
    ClassFilter exclusion = new ClassFilter() {
      public boolean matches(Class clazz) {
        return !(introducedInterface.isAssignableFrom(clazz));
      }
    };

View Full Code Here

Examples of org.springframework.aop.ClassFilter

 
  public void testMatchExplicit() {
    String expression = "execution(int org.springframework.beans.TestBean.getAge())";

    Pointcut pointcut = getPointcut(expression);
    ClassFilter classFilter = pointcut.getClassFilter();
    MethodMatcher methodMatcher = pointcut.getMethodMatcher();

    assertMatchesTestBeanClass(classFilter);

    // not currently testable in a reliable fashion
View Full Code Here

Examples of org.springframework.aop.ClassFilter

  public void testMatchWithTypePattern() throws Exception {
    String expression = "execution(* *..TestBean.*Age(..))";

    Pointcut pointcut = getPointcut(expression);
    ClassFilter classFilter = pointcut.getClassFilter();
    MethodMatcher methodMatcher = pointcut.getMethodMatcher();

    assertMatchesTestBeanClass(classFilter);

    // not currently testable in a reliable fashion
View Full Code Here

Examples of org.springframework.aop.ClassFilter

 
  public void testMatchWithArgs() throws Exception {
    String expression = "execution(void org.springframework.beans.TestBean.setSomeNumber(Number)) && args(Double)";

    Pointcut pointcut = getPointcut(expression);
    ClassFilter classFilter = pointcut.getClassFilter();
    MethodMatcher methodMatcher = pointcut.getMethodMatcher();

    assertMatchesTestBeanClass(classFilter);

    // not currently testable in a reliable fashion
View Full Code Here

Examples of org.springframework.aop.ClassFilter

  public void testUnion() {
    assertTrue(exceptionFilter.matches(RuntimeException.class));
    assertFalse(exceptionFilter.matches(TestBean.class));
    assertFalse(itbFilter.matches(Exception.class));
    assertTrue(itbFilter.matches(TestBean.class));
    ClassFilter union = ClassFilters.union(exceptionFilter, itbFilter);
    assertTrue(union.matches(RuntimeException.class));
    assertTrue(union.matches(TestBean.class));
  }
View Full Code Here

Examples of org.springframework.aop.ClassFilter

  }
 
  public void testIntersection() {
    assertTrue(exceptionFilter.matches(RuntimeException.class));
    assertTrue(hasRootCauseFilter.matches(NestedRuntimeException.class));
    ClassFilter intersection = ClassFilters.intersection(exceptionFilter, hasRootCauseFilter);
    assertFalse(intersection.matches(RuntimeException.class));
    assertFalse(intersection.matches(TestBean.class));
    assertTrue(intersection.matches(NestedRuntimeException.class));
  }
View Full Code Here

Examples of org.springframework.aop.ClassFilter

  public void testFilterByClass() throws NoSuchMethodException {
    ComposablePointcut pc = new ComposablePointcut();
 
    assertTrue(pc.getClassFilter().matches(Object.class));
   
    ClassFilter cf = new RootClassFilter(Exception.class);
    pc.intersection(cf);
    assertFalse(pc.getClassFilter().matches(Object.class));
    assertTrue(pc.getClassFilter().matches(Exception.class));
    pc.intersection(new RootClassFilter(NestedRuntimeException.class));
    assertFalse(pc.getClassFilter().matches(Exception.class));
View Full Code Here

Examples of org.springframework.aop.ClassFilter

*/
public class MyPointcut implements Pointcut {

 
    public ClassFilter getClassFilter() {
        return new ClassFilter() {
         
            public boolean matches(Class cls) {
                return (cls == AutoBean.class);
            }
        };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.