Package org.jboss.aop

Examples of org.jboss.aop.ClassAdvisor


 
  public void testTypeExpressions() throws Exception
  {
     Class introducedPOJO = IntroducedPOJO.class;
     ClassAdvisor advisor = AspectManager.instance().getAdvisor(introducedPOJO);

     Introduced introduced = advisor.resolveTypedAnnotation(Introduced.class);
     assertNotNull("Class did not have the @Introduced annotation", introduced);
    
     Constructor con = introducedPOJO.getConstructors()[0];
     introduced = advisor.resolveTypedAnnotation(con, Introduced.class);
     assertNotNull("Constructor did not have the @Introduced annotation", introduced);
     Introduced2 introduced2 = advisor.resolveTypedAnnotation(con, Introduced2.class);
     assertNotNull("Constructor did not have the @Introduced2 annotation", introduced2);
     Introduced3 introduced3 = advisor.resolveTypedAnnotation(con, Introduced3.class);
     assertNull("Constructor has the @Introduced3 annotation", introduced3);
    
     Field field = introducedPOJO.getField("field");
     introduced = advisor.resolveTypedAnnotation(field, Introduced.class);
     assertNotNull("Field did not have the @Introduced annotation", introduced);
     introduced2 = advisor.resolveTypedAnnotation(field, Introduced2.class);
     assertNotNull("Field did not have the @Introduced2 annotation", introduced2);
    
     Method method = introducedPOJO.getMethod("someMethod", new Class[]{Type.class, Type.class});
     introduced = advisor.resolveTypedAnnotation(method, Introduced.class);
     assertNotNull("Method did not have the @Introduced annotation", introduced);
     introduced2 = advisor.resolveTypedAnnotation(method, Introduced2.class);
     assertNotNull("Method did not have the @Introduced2 annotation", introduced2);
     introduced3 = advisor.resolveTypedAnnotation(method, Introduced3.class);
     assertNull("Method has the @Introduced3 annotation", introduced3);
}
View Full Code Here


            return (Interceptor)icptr;
         }
         else if (joinpoint instanceof FieldJoinpoint)
         {
            FieldJoinpoint field = (FieldJoinpoint) joinpoint;
            ClassAdvisor classAdvisor = (ClassAdvisor) advisor;
            return (Interceptor) classAdvisor.getFieldAspect(field, aspect);
         }
        
         return (Interceptor) aspect.getFactory().createPerJoinpoint(advisor, joinpoint);
      }
      else
View Full Code Here

      else if (joinpoint instanceof FieldJoinpoint)
      {
         FieldJoinpoint field = (FieldJoinpoint) joinpoint;
         if (Modifier.isStatic(field.getField().getModifiers()))
         {
            ClassAdvisor classAdvisor = (ClassAdvisor) advisor;
            return (Interceptor)classAdvisor.getFieldAspect(field, def);
         }

      }
      return new PerJoinpointInterceptor(def, advisor, joinpoint);
   }
View Full Code Here

            return (Interceptor)icptr;
         }
         else if (joinpoint instanceof FieldJoinpoint)
         {
            FieldJoinpoint field = (FieldJoinpoint) joinpoint;
            ClassAdvisor classAdvisor = (ClassAdvisor) advisor;
            return (Interceptor) classAdvisor.getFieldAspect(field, aspect);
         }
        
         return (Interceptor) aspect.getFactory().createPerJoinpoint(advisor, joinpoint);
      }
      else
View Full Code Here

      else if (joinpoint instanceof FieldJoinpoint)
      {
         FieldJoinpoint field = (FieldJoinpoint) joinpoint;
         if (Modifier.isStatic(field.getField().getModifiers()))
         {
            ClassAdvisor classAdvisor = (ClassAdvisor) advisor;
            Object aspect = classAdvisor.getFieldAspect(field, def);
            return PerVmAdvice.generateInterceptor(joinpoint, aspect, adviceName);
         }
      }
      return new PerJoinpointAdvice(adviceName, def, advisor, joinpoint);
   }
View Full Code Here

            }
         }
         else if (joinpoint instanceof FieldJoinpoint)
         {
            FieldJoinpoint field = (FieldJoinpoint) joinpoint;
            ClassAdvisor classAdvisor = (ClassAdvisor) advisor;
            instance = classAdvisor.getFieldAspect(field, aspect);
         }
         else
         {
            instance = aspect.getFactory().createPerJoinpoint(advisor, joinpoint);  
         }
View Full Code Here

            }
            if (!isTransformable(ctRef)) continue;
           
            it.addSuperClass(ctRef);
           
            ClassAdvisor advisor = manager.getTempClassAdvisor(ctRef);
           
           
            if (!manager.getInterceptionMarkers().shouldSkipFieldAccess(ref) && !ref.equals(clazz.getName()))
            {
               List fields = getAdvisableFields(ctRef);
View Full Code Here

   private boolean isTargetConstructorAdvised(CtConstructor calledConstructor)
   {
      try
      {
         ClassAdvisor adv = manager.getTempClassAdvisor(calledConstructor.getDeclaringClass());
         return ConstructorExecutionTransformer.isAdvisableConstructor(calledConstructor, adv);
      }
      catch (Exception e)
      {
         throw new RuntimeException(e);
View Full Code Here

      if (superClass == null || superClass.getName().indexOf("java.") == 0)
      {
         return false;
      }

      ClassAdvisor advisor;
      try
      {
         //TODO Would ideally like to be able to use the existing advisor if class already exists
         advisor = instrumentor.getManager().getTempClassAdvisor(superClass);
      }
View Full Code Here

      {
         Map.Entry entry = (Map.Entry) it.next();
         String classname = (String) entry.getKey();
         indenter(pw, indent);
         pw.println("<class name=\"" + classname + "\">");
         ClassAdvisor advisor = (ClassAdvisor) entry.getValue();
         outputAdvisor(indent + 1, pw, advisor, classname);
         indenter(pw, indent);
         pw.println("</class>");
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.aop.ClassAdvisor

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.