Examples of PointcutExpression


Examples of org.jboss.aop.pointcut.PointcutExpression

   private void updatePointcutStats(Pointcut pointcut, AspectManager manager)
   {
      // the following is for performance reasons.
      if (pointcut instanceof PointcutExpression)
      {
         PointcutExpression expr = (PointcutExpression) pointcut;
         expr.setManager(manager);
         PointcutStats stats = expr.getStats();
         updateStats(stats);
      }
      else
      {
         // can't be sure so set all
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

      ArrayList<InterceptorFactory> interceptors = loadInterceptors(element);
      InterceptorFactory[] inters = interceptors.toArray(new InterceptorFactory[interceptors.size()]);
      Pointcut p = null;
      try
      {
         p = new PointcutExpression(getName("binding pointcut "), pointcut);
      }
      catch (ParseException ex)
      {
         throw new RuntimeException("<bind> pointcut expression failed: " + pointcut, ex);
      }
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

         throw new RuntimeException("pointcut declaration must have an expr associated with it");
      }
      Pointcut p = null;
      try
      {
         p = new PointcutExpression(name, expr);
      }
      catch (ParseException ex)
      {
         throw new RuntimeException("<pointcut name='" + name + "' expr='" + expr + "'/> failed", ex);
      }
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

         throw new RuntimeException("pointcut declaration must have an expr associated with it");
      }
      Pointcut p = null;
      try
      {
         p = new PointcutExpression(name, expr);
      }
      catch (ParseException ex)
      {
         throw new RuntimeException("<prepare> failed: " + expr, ex);
      }
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

   private void updatePointcutStats(Pointcut pointcut, AspectManager manager)
   {
      // the following is for performance reasons.
      if (pointcut instanceof PointcutExpression)
      {
         PointcutExpression expr = (PointcutExpression) pointcut;
         expr.setManager(manager);
         PointcutStats stats = expr.getStats();
         updateStats(stats);
      }
      else
      {
         // can't be sure so set all
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

      createAndCheckPointcut("call(org.acme.Class->new()) AND withincode(* org.acme.Class->method())", false, false, false, false, false, false, true, true);
      createAndCheckPointcut("execution(org.acme.Class->new()) OR field(* org.acme.Class->fld)", false, true, true, true, false, false, false, false);
     
      //Check that named pointcuts work
      AspectManager manager = AspectManager.instance();
      PointcutExpression pointcut1 = new PointcutExpression("METHOD", "execution(void org.acme.Class->method())");
      manager.addPointcut(pointcut1);
      PointcutExpression pointcut2 = new PointcutExpression("CONSTRUCTOR", "execution(org.acme.Class->new())");
      manager.addPointcut(pointcut2);
      PointcutExpression pointcut3 = new PointcutExpression("COMPOSITION", "METHOD OR CONSTRUCTOR");
      manager.addPointcut(pointcut3);
      PointcutStats stats = pointcut3.getStats();
      assertTrue(stats.isMethodExecution());
      assertTrue(stats.isConstructorExecution());
      assertFalse(stats.isGet());
      assertFalse(stats.isSet());
      assertFalse(stats.isMethodCall());
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

         boolean methodCall,
         boolean constructorCall,
         boolean withincode) throws Exception
   {
      AspectManager manager = AspectManager.instance();
      PointcutExpression pointcut = new PointcutExpression("TEST", expression);
      manager.addPointcut(pointcut);
      PointcutStats stats = pointcut.getStats();
      AdviceBinding binding = new AdviceBinding(expression, null);
      manager.addBinding(binding);
     
      assertEquals(methodExecution, stats.isMethodExecution());
      assertEquals(methodExecution, BindingClassifier.isMethodExecution(binding));
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

   protected void addAspectBinding(AspectManager manager, int index, Scope scope, String aspectClass, String adviceName, String pointcut) throws ParseException
   {
      AspectDefinition def = new AspectDefinition("aspect" + index, scope, new GenericAspectFactory(aspectClass, null));
     
      InterceptorFactory advice = (adviceName != null) ? new AdviceFactory(def, "advice") : new ScopedInterceptorFactory(def);
      PointcutExpression pc = new PointcutExpression("pc2" + index, pointcut);
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("binding" + index, pc, null, null, interceptors);

      manager.addAspectDefinition(def);
      manager.addInterceptorFactory(advice.getName(), advice);
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

      domain.addAspectDefinition(def);
      AdviceFactory advice = new AdviceFactory(def, "invoke");
      domain.addInterceptorFactory(advice.getName(), advice);
      //PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(java.lang.String $instanceof{" + POJO.class.getName() + "}->helloWorld(..))");
      {
      PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(java.lang.String " + POJO.class.getName() + "->helloWorld(..))");
      domain.addPointcut(pointcut);
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("pojo-binding", pointcut, null, null, interceptors);
      domain.addBinding(binding);
      }

      {
      PointcutExpression pointcut = new PointcutExpression("mixin-pointcut", "execution(java.lang.String $instanceof{" + MixinInterface.class.getName() + "}->intercepted(..))");
      domain.addPointcut(pointcut);
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("mixin-binding", pointcut, null, null, interceptors);
      domain.addBinding(binding);
      }
View Full Code Here

Examples of org.jboss.aop.pointcut.PointcutExpression

      AspectDefinition def = new AspectDefinition("aspect", Scope.PER_VM, new GenericAspectFactory(EchoInterceptor.class.getName(), null));
      domain.addAspectDefinition(def);
      AdviceFactory advice = new AdviceFactory(def, "invoke");
      domain.addInterceptorFactory(advice.getName(), advice);
      {
      PointcutExpression pointcut = new PointcutExpression("pointcut", "execution(* " + POJOWithFinalMethods.class.getName() + "->*(..))");
      domain.addPointcut(pointcut);
      InterceptorFactory[] interceptors = {advice};
      AdviceBinding binding = new AdviceBinding("pojo-binding", pointcut, null, null, interceptors);
      domain.addBinding(binding);
      }
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.