Examples of Pointcut


Examples of org.springframework.aop.Pointcut

  public void setValidatorFactory(ValidatorFactory validatorFactory) {
    this.validator = validatorFactory.getValidator();
  }

  public void afterPropertiesSet() {
    Pointcut pointcut = new AnnotationMatchingPointcut(this.validatedAnnotationType, true);
    Advice advice = (this.validator != null ? new MethodValidationInterceptor(this.validator) :
        new MethodValidationInterceptor());
    this.advisor = new DefaultPointcutAdvisor(pointcut, advice);
  }
View Full Code Here

Examples of org.springframework.aop.Pointcut

    this.declarationOrder = declarationOrderInAspect;
    this.aspectName = aspectName;
   
    if (aif.getAspectMetadata().isLazilyInstantiated()) {
      // Static part of the pointcut is a lazy type.
      Pointcut preInstantiationPointcut =
          Pointcuts.union(aif.getAspectMetadata().getPerClausePointcut(), this.declaredPointcut);
     
      // Make it dynamic: must mutate from pre-instantiation to post-instantiation state.
      // If it's not a dynamic pointcut, it may be optimized out
      // by the Spring AOP infrastructure after the first evaluation.
View Full Code Here

Examples of org.springframework.aop.Pointcut

   * Build a 'safe' pointcut that excludes the AspectJ advice method itself.
   * @return a composable pointcut that builds on the original AspectJ expression pointcut
   * @see #getPointcut()
   */
  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

Examples of org.springframework.aop.Pointcut

   * @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);
View Full Code Here

Examples of org.springframework.aop.Pointcut

   * Build a 'safe' pointcut that excludes the AspectJ advice method itself.
   * @return a composable pointcut that builds on the original AspectJ expression pointcut
   * @see #getPointcut()
   */
  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

Examples of org.springframework.aop.Pointcut

  private Method isPostProcessed;
 
  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
    //assertDoesNotMatchStringClass(classFilter);
View Full Code Here

Examples of org.springframework.aop.Pointcut

 

  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
    //assertDoesNotMatchStringClass(classFilter);
View Full Code Here

Examples of org.springframework.aop.Pointcut

 
  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
    //assertDoesNotMatchStringClass(classFilter);
View Full Code Here

Examples of org.springframework.aop.Pointcut

  }

  private TestBean getAdvisedProxy(String pointcutExpression, CallCountingInterceptor interceptor) {
    TestBean target = new TestBean();

    Pointcut pointcut = getPointcut(pointcutExpression);

    DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor();
    advisor.setAdvice(interceptor);
    advisor.setPointcut(pointcut);
View Full Code Here

Examples of org.springframework.aop.Pointcut

    }

  }

  public void testAndSubstitution() {
    Pointcut pc = getPointcut("execution(* *(..)) and args(String)");
    PointcutExpression expr =
      ((AspectJExpressionPointcut) pc).getPointcutExpression();
    assertEquals("execution(* *(..)) && args(String)",expr.getPointcutExpression());
  }
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.