Examples of Advice


Examples of org.aopalliance.aop.Advice

    throw new UnknownAdviceTypeException(advice);
  }

  public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException {
    List interceptors = new ArrayList(3);
    Advice advice = advisor.getAdvice();
    if (advice instanceof MethodInterceptor) {
      interceptors.add(advice);
    }
    for (int i = 0; i < this.adapters.size(); i++) {
      AdvisorAdapter adapter = (AdvisorAdapter) this.adapters.get(i);
View Full Code Here

Examples of org.aopalliance.aop.Advice

    assertTrue(SerializationTestUtils.isSerializable(sp));

    ProxyFactory pf = new ProxyFactory(sp);

    // This isn't serializable
    Advice i = new NopInterceptor();
    pf.addAdvice(i);
    assertFalse(SerializationTestUtils.isSerializable(i));
    Object proxy = createAopProxy(pf).getProxy();

    assertFalse(SerializationTestUtils.isSerializable(proxy));
View Full Code Here

Examples of org.aopalliance.aop.Advice

    assertEquals(p, p2);
    assertNotSame(p, p2);
    assertEquals("serializableSingleton", p2.getName());
   
    // Add unserializable advice
    Advice nop = new NopInterceptor();
    ((Advised) p).addAdvice(nop);
    // Check it still works
    assertEquals(p2.getName(), p2.getName());
    assertFalse("Not serializable because an interceptor isn't serializable", SerializationTestUtils.isSerializable(p));
   
View Full Code Here

Examples of org.aopalliance.aop.Advice

        // wrap every Advice in an Advisor instance that returns it in all cases
        int len = advices.length + 1;
        Advisor[] advisors = new Advisor[len];

        // always add the standard CurrentConversationAdvice, and do it FIRST, so it runs first
        Advice currConvAdvice = new CurrentConversationAdvice(conversation, beanName);
        advisors[0] = new SimpleAdvisor(currConvAdvice);
        for(int i=0; i<advices.length; ++i)
        {
            advisors[i+1] = new SimpleAdvisor(advices[i]);
        }
View Full Code Here

Examples of org.aopalliance.aop.Advice

        // wrap every Advice in an Advisor instance that returns it in all cases
        int len = advices.length + 1;
        Advisor[] advisors = new Advisor[len];

        // always add the standard CurrentConversationAdvice, and do it FIRST, so it runs first
        Advice currConvAdvice = new CurrentConversationAdvice(conversation, beanName);
        advisors[0] = new SimpleAdvisor(currConvAdvice);
        for(int i=0; i<advices.length; ++i)
        {
            advisors[i+1] = new SimpleAdvisor(advices[i]);
        }
View Full Code Here

Examples of org.aopalliance.aop.Advice

        // wrap every Advice in an Advisor instance that returns it in all cases
        int len = advices.length + 1;
        Advisor[] advisors = new Advisor[len];

        // always add the standard CurrentConversationAdvice, and do it FIRST, so it runs first
        Advice currConvAdvice = new CurrentConversationAdvice(conversation, beanName);
        advisors[0] = new SimpleAdvisor(currConvAdvice);
        for(int i=0; i<advices.length; ++i)
        {
            advisors[i+1] = new SimpleAdvisor(advices[i]);
        }
View Full Code Here

Examples of org.aopalliance.aop.Advice

    assertTrue(SerializationTestUtils.isSerializable(sp));

    ProxyFactory pf = new ProxyFactory(sp);

    // This isn't serializable
    Advice i = new NopInterceptor();
    pf.addAdvice(i);
    assertFalse(SerializationTestUtils.isSerializable(i));
    Object proxy = createAopProxy(pf).getProxy();

    assertFalse(SerializationTestUtils.isSerializable(proxy));
View Full Code Here

Examples of org.aspectj.lang.reflect.Advice

  private void initDeclaredAdvice() {
    Method[] methods = clazz.getDeclaredMethods();
    List<Advice> adviceList = new ArrayList<Advice>();
    for (Method method : methods) {
      Advice advice = asAdvice(method);
      if (advice != null) adviceList.add(advice);
    }
    declaredAdvice = new Advice[adviceList.size()];
    adviceList.toArray(declaredAdvice);
  }
View Full Code Here

Examples of org.aspectj.weaver.Advice

      Pointcut newP = rewriter.rewrite(p);
      // validateBindings now whilst we still have around the pointcut
      // that resembles what the user actually wrote in their program
      // text.
      if (munger instanceof Advice) {
        Advice advice = (Advice) munger;
        if (advice.getSignature() != null) {
          final int numFormals;
          final String names[];
          // If the advice is being concretized in a @AJ aspect *and*
          // the advice was declared in
          // an @AJ aspect (it could have been inherited from a code
          // style aspect) then
          // evaluate the alternative set of formals. pr125699
          if ((advice.getConcreteAspect().isAnnotationStyleAspect() && advice.getDeclaringAspect() != null && advice
              .getDeclaringAspect().resolve(world).isAnnotationStyleAspect())
              || advice.isAnnotationStyle()) {
            numFormals = advice.getBaseParameterCount();
            int numArgs = advice.getSignature().getParameterTypes().length;
            if (numFormals > 0) {
              names = advice.getSignature().getParameterNames(world);
              validateBindings(newP, p, numArgs, names);
            }
          } else {
            numFormals = advice.getBaseParameterCount();
            if (numFormals > 0) {
              names = advice.getBaseParameterNames(world);
              validateBindings(newP, p, numFormals, names);
            }
          }
        }
      }
View Full Code Here

Examples of org.aspectj.weaver.Advice

        } else {
          counter = dwCtr++;
        }
        parent.addChild(createDeclareErrorOrWarningChild(asm, aspect, decl, counter));
      } else if (element instanceof Advice) {
        Advice advice = (Advice) element;
        parent.addChild(createAdviceChild(asm, advice));
      } else if (element instanceof DeclareParents) {
        parent.addChild(createDeclareParentsChild(asm, (DeclareParents) element));
      } else if (element instanceof BcelTypeMunger) {
        IProgramElement newChild = createIntertypeDeclaredChild(asm, aspect, (BcelTypeMunger) element);
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.