Package org.jboss.aop.AspectAnnotationLoaderStrategy

Examples of org.jboss.aop.AspectAnnotationLoaderStrategy.InterfaceIntroductionInfo


         mv = binfo.getMemberValue("isTransient");
         boolean isTransient = (mv != null) ? ((BooleanMemberValue) mv).getValue() : true;//Note! this should be the same as the default in @Mixin

         String name = cf.getName() + "." + minfo.getName(); //Name of the method defined on
        
         InterfaceIntroductionInfo intro = null;
         String construction = name;
         switch(Descriptor.numOfParameters(minfo.getDescriptor()))
         {
            case 0:
               construction += "()";
               intro = createIntroduction(name, target, typeExpression, null, null, null);//cf.getName(), minfo.getName());
               break;
            case 1:
               construction += "(this)";
               intro = createIntroduction(name, target, typeExpression, null, cf.getName(), minfo.getName());              
 
               String parameter = Descriptor.getParamDescriptor(minfo.getDescriptor());
              
               if (parameter.charAt(1) != 'L')
               {
                  String errorMessage = "Mixin creator method '" + name +
                  "' parameter is primitive type ";
                  char desc = parameter.charAt(1);
                  if (desc == ((CtPrimitiveType) CtClass.booleanType).getDescriptor())
                  {
                     errorMessage += "boolean";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.byteType).getDescriptor())
                  {
                     errorMessage += "byte";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.charType).getDescriptor())
                  {
                     errorMessage += "char";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.doubleType).getDescriptor())
                  {
                     errorMessage += "double";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.floatType).getDescriptor())
                  {
                     errorMessage += "float";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.intType).getDescriptor())
                  {
                     errorMessage += "int";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.longType).getDescriptor())
                  {
                     errorMessage += "long";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.shortType).getDescriptor())
                  {
                     errorMessage += "short";
                  }
                  else
                  {
                     break;
                  }
                  errorMessage += ".\n   It should have the introduction target type as parameter, or have no parameter at all.";
                  throw new RuntimeException(errorMessage);

               }
               break;
            default:
               throw new RuntimeException("Mixin creator method '" + name +
                     "' should not have more than one parameter.");
         }
        
         if (!Modifier.isStatic(minfo.getAccessFlags()) ||
               !Modifier.isPublic(minfo.getAccessFlags()))
         {
            throw new RuntimeException("Mixin creator method '" + name +
                  "' must be public and static.");
         }
        
         //Parse the descriptor to get the returntype of the method.
         String classname = getReturnType(minfo);
        
         intro.addMixin(new InterfaceIntroductionMixinInfo(classname, interfaces, construction, isTransient));

         loaderStrategy.deployInterfaceIntroduction(this, intro);
      }
   }
View Full Code Here


         String[] interfaces = new String[values.length];
         for (int i = 0; i < values.length; i++) interfaces[i] = ((ClassMemberValue) values[i]).getValue();

         String name = cf.getName() + "." + finfo.getName(); //Name of the field defined on

         InterfaceIntroductionInfo interfaceIntro = createIntroduction(name, target, typeExpression, interfaces, null, null);
         loaderStrategy.deployInterfaceIntroduction(this, interfaceIntro);
      }
   }
View Full Code Here

      if (target == null && typeExpression == null)
      {
         throw new RuntimeException("You cannot define both a target and typeExpression attribute in the same @Mixin");
      }

      InterfaceIntroductionInfo intro = new InterfaceIntroductionInfo(name, interfaces, target, typeExpression, constructorClass, constructorMethod);

      return intro;
   }
View Full Code Here

         mv = binfo.getMemberValue("isTransient");
         boolean isTransient = (mv != null) ? ((BooleanMemberValue) mv).getValue() : true;//Note! this should be the same as the default in @Mixin

         String name = cf.getName() + "." + minfo.getName(); //Name of the method defined on
        
         InterfaceIntroductionInfo intro = null;
         String construction = name;
         switch(Descriptor.numOfParameters(minfo.getDescriptor()))
         {
            case 0:
               construction += "()";
               intro = createIntroduction(name, target, typeExpression, null, null, null);//cf.getName(), minfo.getName());
               break;
            case 1:
               construction += "(this)";
               intro = createIntroduction(name, target, typeExpression, null, cf.getName(), minfo.getName());              
 
               String parameter = Descriptor.getParamDescriptor(minfo.getDescriptor());
              
               if (parameter.charAt(1) != 'L')
               {
                  String errorMessage = "Mixin creator method '" + name +
                  "' parameter is primitive type ";
                  char desc = parameter.charAt(1);
                  if (desc == ((CtPrimitiveType) CtClass.booleanType).getDescriptor())
                  {
                     errorMessage += "boolean";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.byteType).getDescriptor())
                  {
                     errorMessage += "byte";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.charType).getDescriptor())
                  {
                     errorMessage += "char";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.doubleType).getDescriptor())
                  {
                     errorMessage += "double";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.floatType).getDescriptor())
                  {
                     errorMessage += "float";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.intType).getDescriptor())
                  {
                     errorMessage += "int";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.longType).getDescriptor())
                  {
                     errorMessage += "long";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.shortType).getDescriptor())
                  {
                     errorMessage += "short";
                  }
                  else
                  {
                     break;
                  }
                  errorMessage += ".\n   It should have the introduction target type as parameter, or have no parameter at all.";
                  throw new RuntimeException(errorMessage);

               }
               break;
            default:
               throw new RuntimeException("Mixin creator method '" + name +
                     "' should not have more than one parameter.");
         }
        
         if (!Modifier.isStatic(minfo.getAccessFlags()) ||
               !Modifier.isPublic(minfo.getAccessFlags()))
         {
            throw new RuntimeException("Mixin creator method '" + name +
                  "' must be public and static.");
         }
        
         //Parse the descriptor to get the returntype of the method.
         String classname = getReturnType(minfo);
        
         intro.addMixin(new InterfaceIntroductionMixinInfo(classname, interfaces, construction, isTransient));

         loaderStrategy.deployInterfaceIntroduction(this, intro);
      }
   }
View Full Code Here

         String[] interfaces = new String[values.length];
         for (int i = 0; i < values.length; i++) interfaces[i] = ((ClassMemberValue) values[i]).getValue();

         String name = cf.getName() + "." + finfo.getName(); //Name of the field defined on

         InterfaceIntroductionInfo interfaceIntro = createIntroduction(name, target, typeExpression, interfaces, null, null);
         loaderStrategy.deployInterfaceIntroduction(this, interfaceIntro);
      }
   }
View Full Code Here

      if (target == null && typeExpression == null)
      {
         throw new RuntimeException("You cannot define both a target and typeExpression attribute in the same @Mixin");
      }

      InterfaceIntroductionInfo intro = new InterfaceIntroductionInfo(name, interfaces, target, typeExpression, constructorClass, constructorMethod);

      return intro;
   }
View Full Code Here

         mv = binfo.getMemberValue("isTransient");
         boolean isTransient = (mv != null) ? ((BooleanMemberValue) mv).getValue() : true;//Note! this should be the same as the default in @Mixin

         String name = cf.getName() + "." + minfo.getName(); //Name of the method defined on
        
         InterfaceIntroductionInfo intro = null;
         String construction = name;
         switch(Descriptor.numOfParameters(minfo.getDescriptor()))
         {
            case 0:
               construction += "()";
               intro = createIntroduction(name, target, typeExpression, null, null, null);//cf.getName(), minfo.getName());
               break;
            case 1:
               construction += "(this)";
               intro = createIntroduction(name, target, typeExpression, null, cf.getName(), minfo.getName());              
 
               String parameter = Descriptor.getParamDescriptor(minfo.getDescriptor());
              
               if (parameter.charAt(1) != 'L')
               {
                  String errorMessage = "Mixin creator method '" + name +
                  "' parameter is primitive type ";
                  char desc = parameter.charAt(1);
                  if (desc == ((CtPrimitiveType) CtClass.booleanType).getDescriptor())
                  {
                     errorMessage += "boolean";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.byteType).getDescriptor())
                  {
                     errorMessage += "byte";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.charType).getDescriptor())
                  {
                     errorMessage += "char";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.doubleType).getDescriptor())
                  {
                     errorMessage += "double";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.floatType).getDescriptor())
                  {
                     errorMessage += "float";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.intType).getDescriptor())
                  {
                     errorMessage += "int";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.longType).getDescriptor())
                  {
                     errorMessage += "long";
                  }
                  else if (desc == ((CtPrimitiveType) CtClass.shortType).getDescriptor())
                  {
                     errorMessage += "short";
                  }
                  else
                  {
                     break;
                  }
                  errorMessage += ".\n   It should have the introduction target type as parameter, or have no parameter at all.";
                  throw new RuntimeException(errorMessage);

               }
               break;
            default:
               throw new RuntimeException("Mixin creator method '" + name +
                     "' should not have more than one parameter.");
         }
        
         if (!Modifier.isStatic(minfo.getAccessFlags()) ||
               !Modifier.isPublic(minfo.getAccessFlags()))
         {
            throw new RuntimeException("Mixin creator method '" + name +
                  "' must be public and static.");
         }
        
         //Parse the descriptor to get the returntype of the method.
         String classname = getReturnType(minfo);
        
         intro.addMixin(new InterfaceIntroductionMixinInfo(classname, interfaces, construction, isTransient));

         loaderStrategy.deployInterfaceIntroduction(this, intro);
      }
   }
View Full Code Here

         String[] interfaces = new String[values.length];
         for (int i = 0; i < values.length; i++) interfaces[i] = ((ClassMemberValue) values[i]).getValue();

         String name = cf.getName() + "." + finfo.getName(); //Name of the field defined on

         InterfaceIntroductionInfo interfaceIntro = createIntroduction(name, target, typeExpression, interfaces, null, null);
         loaderStrategy.deployInterfaceIntroduction(this, interfaceIntro);
      }
   }
View Full Code Here

      if (target == null && typeExpression == null)
      {
         throw new RuntimeException("You cannot define both a target and typeExpression attribute in the same @Mixin");
      }

      InterfaceIntroductionInfo intro = new InterfaceIntroductionInfo(name, interfaces, target, typeExpression, constructorClass, constructorMethod);

      return intro;
   }
View Full Code Here

TOP

Related Classes of org.jboss.aop.AspectAnnotationLoaderStrategy.InterfaceIntroductionInfo

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.