Package org.springframework.aop.support

Examples of org.springframework.aop.support.ComposablePointcut


  public boolean isPerInstance() {
    return true;
  }

  private Pointcut buildPointcut() {
    ComposablePointcut result = null;
    for (Class<? extends Annotation> publisherAnnotationType : this.annotations) {
      Pointcut mpc = new MetaAnnotationMatchingPointcut(null, publisherAnnotationType);
      if (result == null) {
        result = new ComposablePointcut(mpc);
      } else {
        result.union(mpc);
      }
    }
    return result;
  }
View Full Code Here


    public static void main(String[] args) {
        // create target
        SampleBean target = new SampleBean();

       
        ComposablePointcut pc = new ComposablePointcut(ClassFilter.TRUE,
                new GetterMethodMatcher());

        System.out.println("Test 1");
        SampleBean proxy = getProxy(pc, target);
        testInvoke(proxy);

        System.out.println("Test 2");
        pc.union(new SetterMethodMatcher());
        proxy = getProxy(pc, target);
        testInvoke(proxy);
       
        System.out.println("Test 3");
        pc.intersection(new GetAgeMethodMatcher());
        proxy = getProxy(pc, target);
        testInvoke(proxy);

    }
View Full Code Here

   */
  public final Pointcut buildSafePointcut() {
    Pointcut pc = getPointcut();
    MethodMatcher safeMethodMatcher = MethodMatchers.intersection(
        new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher());
    return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher);
  }
View Full Code Here

        ajexp.setExpression(findPerClause(aspectClass));
        this.perClausePointcut = ajexp;
        return;
      case PERTYPEWITHIN :
        // Works with a type pattern
        this.perClausePointcut = new ComposablePointcut(new TypePatternClassFilter(findPerClause(aspectClass)));
        return;
      default :
        throw new AopConfigException(
            "PerClause " + ajType.getPerClause().getKind() + " not supported by Spring AOP for " + aspectClass);
    }
View Full Code Here

   */
  public final Pointcut buildSafePointcut() {
    Pointcut pc = getPointcut();
    MethodMatcher safeMethodMatcher = MethodMatchers.intersection(
        new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher());
    return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher);
  }
View Full Code Here

        ajexp.setExpression(findPerClause(aspectClass));
        this.perClausePointcut = ajexp;
        return;
      case PERTYPEWITHIN :
        // Works with a type pattern
        this.perClausePointcut = new ComposablePointcut(new TypePatternClassFilter(findPerClause(aspectClass)));
        return;
      default :
        throw new AopConfigException(
            "PerClause " + ajType.getPerClause().getKind() + " not supported by Spring AOP for " + aspectClass);
    }
View Full Code Here

   * Calculate a pointcut for the given async annotation types, if any.
   * @param asyncAnnotationTypes the async annotation types to introspect
   * @return the applicable Pointcut object, or <code>null</code> if none
   */
  protected Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes) {
    ComposablePointcut result = null;
    for (Class<? extends Annotation> asyncAnnotationType : asyncAnnotationTypes) {
      Pointcut cpc = new AnnotationMatchingPointcut(asyncAnnotationType, true);
      Pointcut mpc = new AnnotationMatchingPointcut(null, asyncAnnotationType);
      if (result == null) {
        result = new ComposablePointcut(cpc).union(mpc);
      }
      else {
        result.union(cpc).union(mpc);
      }
    }
    return result;
  }
View Full Code Here

   */
  public final Pointcut buildSafePointcut() {
    Pointcut pc = getPointcut();
    MethodMatcher safeMethodMatcher = MethodMatchers.intersection(
        new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher());
    return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher);
  }
View Full Code Here

   *
   * @param retryAnnotationTypes the retry annotation types to introspect
   * @return the applicable Pointcut object, or {@code null} if none
   */
  protected Pointcut buildPointcut(Set<Class<? extends Annotation>> retryAnnotationTypes) {
    ComposablePointcut result = null;
    for (Class<? extends Annotation> retryAnnotationType : retryAnnotationTypes) {
      Pointcut filter = new AnnotationClassOrMethodPointcut(retryAnnotationType);
      if (result == null) {
        result = new ComposablePointcut(filter);
      }
      else {
        result.union(filter);
      }
    }
    return result;
  }
View Full Code Here

   * Calculate a pointcut for the given async annotation types, if any.
   * @param asyncAnnotationTypes the async annotation types to introspect
   * @return the applicable Pointcut object, or {@code null} if none
   */
  protected Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes) {
    ComposablePointcut result = null;
    for (Class<? extends Annotation> asyncAnnotationType : asyncAnnotationTypes) {
      Pointcut cpc = new AnnotationMatchingPointcut(asyncAnnotationType, true);
      Pointcut mpc = AnnotationMatchingPointcut.forMethodAnnotation(asyncAnnotationType);
      if (result == null) {
        result = new ComposablePointcut(cpc).union(mpc);
      }
      else {
        result.union(cpc).union(mpc);
      }
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.springframework.aop.support.ComposablePointcut

Copyright © 2018 www.massapicom. 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.