Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.FieldGen


    return name;
  }
 
  private String createLuaDoubleField(double value) {
    String name = PREFIX_CONSTANT+constants.size();
    FieldGen fg = new FieldGen(Constants.ACC_STATIC | Constants.ACC_FINAL,
        TYPE_LUAVALUE, name, cp);
    cg.addField(fg.getField());
    init.append(new PUSH(cp, value));
    init.append(factory.createInvoke(STR_LUAVALUE, "valueOf",
        TYPE_LUANUMBER, ARG_TYPES_DOUBLE, Constants.INVOKESTATIC));
    init.append(factory.createPutStatic(classname, name, TYPE_LUAVALUE));     
    return name;
View Full Code Here


    return name;
  }

  private String createLuaStringField(LuaString value) {
    String name = PREFIX_CONSTANT+constants.size();
    FieldGen fg = new FieldGen(Constants.ACC_STATIC | Constants.ACC_FINAL,
        TYPE_LUAVALUE, name, cp);
    cg.addField(fg.getField());
    LuaString ls = value.checkstring();
    if ( ls.isValidUtf8() ) {
      init.append(new PUSH(cp, value.tojstring()));
      init.append(factory.createInvoke(STR_LUASTRING, "valueOf",
          TYPE_LUASTRING, ARG_TYPES_STRING, Constants.INVOKESTATIC));
View Full Code Here

            if (fields[i].getName().equals(TransformationUtil.STATIC_CLASS_FIELD)) {
                return;
            }
        }

        final FieldGen field = new FieldGen(
                Constants.ACC_PRIVATE | Constants.ACC_FINAL | Constants.ACC_STATIC,
                new ObjectType("java.lang.Class"),
                TransformationUtil.STATIC_CLASS_FIELD,
                cp
        );

        cg.addField(field.getField());
    }
View Full Code Here

        if (cg.containsField(joinPoint) != null) {
            return;
        }

        final FieldGen field = new FieldGen(
                Constants.ACC_PRIVATE | Constants.ACC_FINAL | Constants.ACC_STATIC,
                new ObjectType(TransformationUtil.THREAD_LOCAL_CLASS),
                joinPoint,
                cp
        );

        cg.addField(field.getField());
    }
View Full Code Here

     * @param cg the classgen
     */
    private void addUuidField(final ClassGen cg) {
        if (cg.containsField(TransformationUtil.UUID_FIELD) == null) {

            FieldGen field = new FieldGen(
                    Constants.ACC_PRIVATE | Constants.ACC_FINAL,
                    Type.STRING,
                    TransformationUtil.UUID_FIELD,
                    cg.getConstantPool());

            TransformationUtil.addField(cg, field.getField());
        }
    }
View Full Code Here

        if (cg.containsField(joinPoint) != null) {
            return;
        }

        final FieldGen field = new FieldGen(
                Constants.ACC_PRIVATE | Constants.ACC_FINAL,
                new ObjectType(TransformationUtil.THREAD_LOCAL_CLASS),
                joinPoint,
                cp
        );
        cg.addField(field.getField());
    }
View Full Code Here

        if (m_classGen == null) throw new IllegalStateException("attribute enhancer is not initialized");
        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()
                );
                fieldGen.addAttribute(attr);
                Field newField = fieldGen.getField();
                m_classGen.replaceField(classfileField[i], newField);
            }
        }
    }
View Full Code Here

        if (cg.containsField(joinPoint.toString()) != null) {
            return;
        }

        final FieldGen field = new FieldGen(
                Constants.ACC_PRIVATE | Constants.ACC_FINAL,
                joinPointType,
                joinPoint.toString(),
                cp);

        cg.addField(field.getField());
    }
View Full Code Here

        for (int i = 0; i < fields.length; i++) {
            if (fields[i].getName().equals(TransformationUtil.STATIC_CLASS_FIELD))
                return;
        }

        final FieldGen field = new FieldGen(
                Constants.ACC_PRIVATE | Constants.ACC_FINAL | Constants.ACC_STATIC,
                new ObjectType("java.lang.Class"),
                TransformationUtil.STATIC_CLASS_FIELD,
                cp
        );

        cg.addField(field.getField());
    }
View Full Code Here

        if (cg.containsField(joinPoint.toString()) != null) {
            return;
        }

        final FieldGen field = new FieldGen(
                Constants.ACC_PRIVATE | Constants.ACC_FINAL | Constants.ACC_STATIC,
                TransformationUtil.CALLER_SIDE_JOIN_POINT_TYPE,
                joinPoint.toString(),
                cp
        );

        cg.addField(field.getField());
    }
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.FieldGen

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.