Package org.jboss.aop.introduction

Examples of org.jboss.aop.introduction.InterfaceIntroduction


/* 152 */     container.setClass(clazz);
/*     */
/* 154 */     Iterator it = container.getManager().getInterfaceIntroductions().values().iterator();
/* 155 */     while (it.hasNext())
/*     */     {
/* 157 */       InterfaceIntroduction intro = (InterfaceIntroduction)it.next();
/* 158 */       if (intro.matches(container, container.getClazz()))
/*     */       {
/* 160 */         container.addInterfaceIntroduction(intro);
/*     */       }
/*     */     }
/*     */
View Full Code Here


/* 479 */       HashMap intfs = new HashMap();
/* 480 */       HashMap mixinIntfs = new HashMap();
/* 481 */       ArrayList mixes = new ArrayList();
/* 482 */       for (int i = 0; i < this.mixins.size(); i++)
/*     */       {
/* 484 */         InterfaceIntroduction introduction = (InterfaceIntroduction)this.mixins.get(i);
/* 485 */         getIntroductionInterfaces(introduction, intfs, mixinIntfs, mixes, i);
/*     */       }
/* 487 */       if (mixes.size() > 0)
/*     */       {
/* 489 */         this.defaultCtor.insertAfter("mixins = new Object[" + mixes.size() + "];");
View Full Code Here

/* 148 */       indenter(pw, indent);
/* 149 */       pw.println("<introductions>");
/* 150 */       indent++;
/* 151 */       for (int i = 0; i < introductions.size(); i++)
/*     */       {
/* 153 */         InterfaceIntroduction pointcut = (InterfaceIntroduction)introductions.get(i);
/* 154 */         indenter(pw, indent);
/* 155 */         pw.println("<introduction classExpr=\"" + pointcut.getClassExpr() + "\">");
/* 156 */         indent++;
/* 157 */         String[] intfs = pointcut.getInterfaces();
/* 158 */         ArrayList mixins = pointcut.getMixins();
/*     */
/* 160 */         if ((intfs != null) && (intfs.length > 0))
/*     */         {
/* 163 */           for (int j = 0; j < intfs.length; j++)
/*     */           {
View Full Code Here

/*  641 */         mv = binfo.getMemberValue("isTransient");
/*  642 */         boolean isTransient = mv != null ? ((BooleanMemberValue)mv).getValue() : true;
/*      */
/*  644 */         String name = cf.getName() + "." + minfo.getName();
/*      */
/*  646 */         InterfaceIntroduction intro = null;
/*  647 */         String construction = name;
/*  648 */         switch (Descriptor.numOfParameters(minfo.getDescriptor()))
/*      */         {
/*      */         case 0:
/*  651 */           construction = construction + "()";
/*  652 */           intro = createIntroduction(name, target, typeExpression, null, null, null);
/*  653 */           break;
/*      */         case 1:
/*  655 */           construction = construction + "(this)";
/*  656 */           intro = createIntroduction(name, target, typeExpression, null, cf.getName(), minfo.getName());
/*      */
/*  658 */           String parameter = Descriptor.getParamDescriptor(minfo.getDescriptor());
/*      */
/*  660 */           if (parameter.charAt(1) == 'L')
/*      */             break;
/*  662 */           String errorMessage = "Mixin creator method '" + name + "' parameter is primitive type ";
/*      */
/*  664 */           char desc = parameter.charAt(1);
/*  665 */           if (desc == ((CtPrimitiveType)CtClass.booleanType).getDescriptor())
/*      */           {
/*  667 */             errorMessage = errorMessage + "boolean";
/*      */           }
/*  669 */           else if (desc == ((CtPrimitiveType)CtClass.byteType).getDescriptor())
/*      */           {
/*  671 */             errorMessage = errorMessage + "byte";
/*      */           }
/*  673 */           else if (desc == ((CtPrimitiveType)CtClass.charType).getDescriptor())
/*      */           {
/*  675 */             errorMessage = errorMessage + "char";
/*      */           }
/*  677 */           else if (desc == ((CtPrimitiveType)CtClass.doubleType).getDescriptor())
/*      */           {
/*  679 */             errorMessage = errorMessage + "double";
/*      */           }
/*  681 */           else if (desc == ((CtPrimitiveType)CtClass.floatType).getDescriptor())
/*      */           {
/*  683 */             errorMessage = errorMessage + "float";
/*      */           }
/*  685 */           else if (desc == ((CtPrimitiveType)CtClass.intType).getDescriptor())
/*      */           {
/*  687 */             errorMessage = errorMessage + "int";
/*      */           }
/*  689 */           else if (desc == ((CtPrimitiveType)CtClass.longType).getDescriptor())
/*      */           {
/*  691 */             errorMessage = errorMessage + "long";
/*      */           } else {
/*  693 */             if (desc != ((CtPrimitiveType)CtClass.shortType).getDescriptor())
/*      */               break;
/*  695 */             errorMessage = errorMessage + "short";
/*      */           }
/*      */
/*  701 */           errorMessage = errorMessage + ".\n   It should have the introduction target type as parameter, or have no parameter at all.";
/*  702 */           throw new RuntimeException(errorMessage);
/*      */         default:
/*  707 */           throw new RuntimeException("Mixin creator method '" + name + "' should not have more than one parameter.");
/*      */         }
/*      */
/*  711 */         if ((!Modifier.isStatic(minfo.getAccessFlags())) || (!Modifier.isPublic(minfo.getAccessFlags())))
/*      */         {
/*  714 */           throw new RuntimeException("Mixin creator method '" + name + "' must be public and static.");
/*      */         }
/*      */
/*  719 */         String classname = getReturnType(minfo);
/*      */
/*  721 */         intro.getMixins().add(new InterfaceIntroduction.Mixin(classname, interfaces, construction, isTransient));
/*      */
/*  723 */         this.manager.addInterfaceIntroduction(intro);
/*      */       }
/*      */     }
/*      */   }
View Full Code Here

/*  774 */         String[] interfaces = new String[values.length];
/*  775 */         for (int i = 0; i < values.length; i++) interfaces[i] = ((ClassMemberValue)values[i]).getValue();
/*      */
/*  777 */         String name = cf.getName() + "." + finfo.getName();
/*      */
/*  779 */         InterfaceIntroduction interfaceIntro = createIntroduction(name, target, typeExpression, interfaces, null, null);
/*  780 */         this.manager.addInterfaceIntroduction(interfaceIntro);
/*      */       }
/*      */     }
/*      */   }
View Full Code Here

/* 1040 */     if ((target == null) && (typeExpression == null))
/*      */     {
/* 1042 */       throw new RuntimeException("You cannot define both a target and typeExpression attribute in the same @Mixin");
/*      */     }
/*      */
/* 1046 */     InterfaceIntroduction intro = null;
/*      */
/* 1048 */     if (target != null)
/*      */     {
/* 1050 */       intro = new InterfaceIntroduction(name, target, interfaces, constructorClass, constructorMethod);
/*      */     }
/*      */     else
/*      */     {
/* 1054 */       ASTStart start = new TypeExpressionParser(new StringReader(typeExpression)).Start();
/* 1055 */       intro = new InterfaceIntroduction(name, start, interfaces, constructorClass, constructorMethod);
/*      */     }
/*      */
/* 1058 */     return intro;
/*      */   }
View Full Code Here

      Iterator<InterfaceIntroduction> it = pointcuts.iterator();
      if (it.hasNext()) setupBasics(clazz);
      while (it.hasNext())
      {

         InterfaceIntroduction pointcut = it.next();
         ArrayList<InterfaceIntroduction.Mixin> mixins = pointcut.getMixins();
         for (InterfaceIntroduction.Mixin mixin: mixins)
         {
            addMixin(clazz, pointcut, mixin, baseMethods);
         }
      }

      // pointcut interfaces.  If a method is already implemented for it then use that method
      // otherwise delegate to an interceptor
      it = pointcuts.iterator();
      while (it.hasNext())
      {
         InterfaceIntroduction pointcut = it.next();
         String[] interfaces = pointcut.getInterfaces();
         if (interfaces == null) continue;
         for (int i = 0; i < interfaces.length; i++)
         {
            addIntroductionPointcutInterface(clazz, advisor, interfaces[i], baseMethods);
         }
View Full Code Here

            if (!intf.equals("")) interfaces.add(intf);
         }
         ifaces = interfaces.toArray(new String[interfaces.size()]);
      }

      InterfaceIntroduction pcut = null;
      if (classExpr != null)
      {
         pcut = new InterfaceIntroduction(name, classExpr, ifaces);
      }
      else
      {
         ASTStart start = new TypeExpressionParser(new StringReader(ast)).Start();
         pcut = new InterfaceIntroduction(name, start, ifaces);
      }
      Iterator it = XmlHelper.getChildrenByTagName(pointcut, "mixin");
      while (it.hasNext())
      {
         Element mixin = (Element) it.next();
         if (mixin != null)
         {
            String construction = XmlHelper.getOptionalChildContent(mixin, "construction");
            String classname = XmlHelper.getUniqueChildContent(mixin, "class");
            String isTransientString = mixin.getAttribute("transient");
            boolean isTransient = true;
            if (isTransientString == null || isTransientString.trim().equals(""))
            {
               isTransient = true;
            }
            else
            {
               isTransient = new Boolean(isTransientString).booleanValue();
            }

            intfs = XmlHelper.getUniqueChildContent(mixin, "interfaces");
            StringTokenizer tokenizer = new StringTokenizer(intfs, ",");
            ArrayList<String> interfaces = new ArrayList<String>();
            while (tokenizer.hasMoreTokens())
            {
               String intf = tokenizer.nextToken().trim();
               if (!intf.equals("")) interfaces.add(intf);
            }
            ifaces = interfaces.toArray(new String[interfaces.size()]);
            pcut.getMixins().add(new InterfaceIntroduction.Mixin(classname, ifaces, construction, isTransient));
         }
      }
      manager.addInterfaceIntroduction(pcut);
   }
View Full Code Here

    */
   public void removeInterfaceIntroduction(String name)
   {
      synchronized (interfaceIntroductions)
      {
         InterfaceIntroduction pointcut = (InterfaceIntroduction) interfaceIntroductions.remove(name);
         if (pointcut == null) return;
         pointcut.clearAdvisors();
      }
   }
View Full Code Here

      if (interfaceIntroductions != null && interfaceIntroductions.size() > 0)
      {
         Iterator it = interfaceIntroductions.values().iterator();
         while (it.hasNext())
         {
            InterfaceIntroduction pointcut = (InterfaceIntroduction) it.next();
            if (pointcut.matches(advisor, clazz))
            {
               pointcut.addAdvisor(advisor);
            }
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.aop.introduction.InterfaceIntroduction

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.