Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.Attribute


     * @param attribute the attribute
     */
    public void insertClassAttribute(final Object attribute) {
        if (m_classGen == null) throw new IllegalStateException("attribute enhancer is not initialized");
        byte[] serializedAttribute = serialize(attribute);
        Attribute attr = new Unknown(
                m_constantPoolGen.addUtf8("Custom"),
                serializedAttribute.length,
                serializedAttribute,
                m_constantPoolGen.getConstantPool()
        );
View Full Code Here


        byte[] serializedAttribute = serialize(attribute);
        Field[] classfileField = m_classGen.getFields();
        for (int i = 0; i < classfileField.length; i++) {
            if (classfileField[i].getName().equals(field.getName())) {
                FieldGen fieldGen = new FieldGen(classfileField[i], m_constantPoolGen);
                Attribute attr = new Unknown(
                        m_constantPoolGen.addUtf8("Custom"),
                        serializedAttribute.length,
                        serializedAttribute,
                        m_constantPoolGen.getConstantPool()
                );
View Full Code Here

                            classfileMethod[i],
                            m_javaClass.getClassName(),
                            m_constantPoolGen
                    );

                    Attribute attr = new Unknown(
                            m_constantPoolGen.addUtf8("Custom"),
                            serializedAttribute.length,
                            serializedAttribute,
                            m_constantPoolGen.getConstantPool()
                    );
View Full Code Here

  private AnnotationEntryGen[] unpackAnnotations(Attribute[] attrs)
  {
    List<AnnotationEntryGen> annotationGenObjs = new ArrayList<AnnotationEntryGen>();
    for (int i = 0; i < attrs.length; i++)
    {
      Attribute attr = attrs[i];
      if (attr instanceof RuntimeVisibleAnnotations)
      {
        RuntimeVisibleAnnotations rva = (RuntimeVisibleAnnotations) attr;
        AnnotationEntry[] annos = rva.getAnnotationEntries();
        for (int j = 0; j < annos.length; j++)
View Full Code Here

      // Find attributes that contain annotation data
      Attribute[] attrs = getAttributes();
      List<AnnotationEntry> accumulatedAnnotations = new ArrayList<AnnotationEntry>();
      for (int i = 0; i < attrs.length; i++)
      {
        Attribute attribute = attrs[i];
        if (attribute instanceof Annotations)
        {
          Annotations annotations = (Annotations) attribute;
          for (int j = 0; j < annotations.getAnnotationEntries().length; j++)
          {
View Full Code Here

    public void insertClassAttribute(final Object attribute) {
        if (m_classGen == null) {
            throw new IllegalStateException("attribute enhancer is not initialized");
        }
        byte[] serializedAttribute = serialize(attribute);
        Attribute attr = new Unknown(
                m_constantPoolGen.addUtf8(AttributeEnhancer.CUSTOM_ATTRIBUTE),
                serializedAttribute.length, serializedAttribute,
                m_constantPoolGen.getConstantPool()
        );
        m_classGen.addAttribute(attr);
View Full Code Here

        byte[] serializedAttribute = serialize(attribute);
        Field[] classfileField = m_classGen.getFields();
        for (int i = 0; i < classfileField.length; i++) {
            if (classfileField[i].getName().equals(field.getName())) {
                FieldGen fieldGen = new FieldGen(classfileField[i], m_constantPoolGen);
                Attribute attr = new Unknown(
                        m_constantPoolGen.addUtf8(AttributeEnhancer.CUSTOM_ATTRIBUTE),
                        serializedAttribute.length, serializedAttribute,
                        m_constantPoolGen.getConstantPool()
                );
                fieldGen.addAttribute(attr);
View Full Code Here

                if (Arrays.equals(methodParamTypes, DescriptorUtil.getParameters(classfileMethod[i].getSignature()))) {
                    MethodGen methodGen = new MethodGen(
                            classfileMethod[i], m_javaClass.getClassName(),
                            m_constantPoolGen
                    );
                    Attribute attr = new Unknown(
                            m_constantPoolGen.addUtf8(AttributeEnhancer.CUSTOM_ATTRIBUTE),
                            serializedAttribute.length, serializedAttribute,
                            m_constantPoolGen.getConstantPool()
                    );
                    methodGen.addAttribute(attr);
View Full Code Here

     * @return
     */
    private static List readAjAttributes(final Attribute[] attrs, final ISourceContext context) {
        List ajAttrs = new ArrayList();
        for (int i = attrs.length - 1; i >= 0; i--) {
            Attribute a = attrs[i];
            if (a instanceof Unknown) {
                Unknown u = (Unknown) a;
                String name = u.getName();
                if (name.startsWith(AjAttribute.AttributePrefix)) {
                    ajAttrs.add(AjAttribute.read(name, u.getBytes(), context));
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.Attribute

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.