Package javassist.bytecode

Examples of javassist.bytecode.ClassFile.addAttribute()


    }

    public void setAttribute(String name, byte[] data) {
        checkModify();
        ClassFile cf = getClassFile2();
        cf.addAttribute(new AttributeInfo(cf.getConstPool(), name, data));
    }

    public void instrument(CodeConverter converter)
        throws CannotCompileException
    {
View Full Code Here


        Annotation annotation = new Annotation(runWithClassName, constPool);
        annotation.addMemberValue("value", new ClassMemberValue(arquillianClassName, constPool));
        attr.addAnnotation(annotation);

        ccFile.addAttribute(attr);
    }

    protected void addDeploymentMethod(CtClass clazz) throws Exception {
        ClassPool pool = clazz.getClassPool();
        CtClass archiveClass = pool.get(WebArchive.class.getName());
View Full Code Here

      ClassFile destFile = dest.getClassFile2();
     
      SignatureAttribute sig = (SignatureAttribute)srcFile.getAttribute(SignatureAttribute.tag);
      if (sig != null)
      {
         destFile.addAttribute(sig.copy(destFile.getConstPool(), new HashMap()));
      }
   }
}  
View Full Code Here

/* 888 */     ClassFile destFile = dest.getClassFile2();
/*     */
/* 890 */     SignatureAttribute sig = (SignatureAttribute)srcFile.getAttribute("Signature");
/* 891 */     if (sig != null)
/*     */     {
/* 893 */       destFile.addAttribute(sig.copy(destFile.getConstPool(), new HashMap()));
/*     */     }
/*     */   }
/*     */ }

/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
View Full Code Here

/*  57 */     ClassFile classFile = clazz.getClassFile();
/*  58 */     AnnotationsAttribute attribute = (AnnotationsAttribute)classFile.getAttribute("RuntimeVisibleAnnotations");
/*  59 */     if (attribute == null)
/*  60 */       attribute = new AnnotationsAttribute(classFile.getConstPool(), "RuntimeVisibleAnnotations");
/*  61 */     attribute.addAnnotation(annotation);
/*  62 */     classFile.addAttribute(attribute);
/*     */   }
/*     */
/*     */   public static Annotation createAnnotation(Class<? extends java.lang.annotation.Annotation> annotation, ConstPool constPool)
/*     */   {
/*  67 */     return new Annotation(annotation, constPool);
View Full Code Here

/* 271 */     AnnotationsAttribute visible = (AnnotationsAttribute)ctClass.getClassFile().getAttribute("RuntimeVisibleAnnotations");
/* 272 */     if (visible == null)
/*     */     {
/* 274 */       ClassFile cf = ctClass.getClassFile();
/* 275 */       visible = new AnnotationsAttribute(cf.getConstPool(), "RuntimeVisibleAnnotations");
/* 276 */       cf.addAttribute(visible);
/*     */     }
/* 278 */     return visible;
/*     */   }
/*     */
/*     */   private void compileMethod(JavaMethod method, AnnotationDocletTag tag, CtClass clazz) throws Exception
View Full Code Here

      // add @Generated
      ConstPool cp = cf.getConstPool();
      AnnotationsAttribute attr = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);
      attr.setAnnotation(new Annotation(Generated.class.getName(), cp));
      cf.addAttribute(attr);

      // write the file
      cf.write(new DataOutputStream(new FileOutputStream(filename)));
    } catch (Exception e) {
      throw new ScannerException("Error while generating the class file", e);
View Full Code Here

      AnnotationsAttribute visible = (AnnotationsAttribute) ctClass.getClassFile().getAttribute(AnnotationsAttribute.visibleTag);
      if (visible == null)
      {
         ClassFile cf = ctClass.getClassFile();
         visible = new AnnotationsAttribute(cf.getConstPool(), AnnotationsAttribute.visibleTag);
         cf.addAttribute(visible);
      }
      return visible;
   }

   private void compileMethod(JavaMethod method, AnnotationDocletTag tag, CtClass clazz) throws Exception
View Full Code Here

/*  790 */       cf.addAttribute(ica);
/*      */     }
/*      */
/*  793 */     ica.append(c.getName(), getName(), name, cf2.getAccessFlags() & 0xFFFFFFDF | 0x8);
/*      */
/*  795 */     cf2.addAttribute(ica.copy(cf2.getConstPool(), null));
/*  796 */     return c;
/*      */   }
/*      */
/*      */   private void nameReplaced()
/*      */   {
View Full Code Here

/*      */   }
/*      */
/*      */   public void setAttribute(String name, byte[] data) {
/* 1346 */     checkModify();
/* 1347 */     ClassFile cf = getClassFile2();
/* 1348 */     cf.addAttribute(new AttributeInfo(cf.getConstPool(), name, data));
/*      */   }
/*      */
/*      */   public void instrument(CodeConverter converter)
/*      */     throws CannotCompileException
/*      */   {
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.