Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ConstantValue


                    result.append(n);
                }

                if (verbose) {
                    // Append a field constant value, if any.
                    ConstantValue cv  = f.getConstantValue();
                    if (cv != null) {
                        result.append(indentString(indent * 2,
                                "Constant value: "));
                        result.append(cv);
                        result.append(n);
View Full Code Here


            int flags = fields[i].getAccessFlags();
            Attribute[] attributes = fields[i].getAttributes();
            for (int j = 0; j < attributes.length; j++) {
                if (attributes[j] instanceof ConstantValue) {
                    flags |= (1<<17);
                    ConstantValue constV = ((ConstantValue)attributes[j]);
                    Constant theConstant = constV.getConstantPool().getConstant(constV.getConstantValueIndex());
                    CPConstant cpConstant = cpBands.getCPConstant(theConstant, constV.getConstantPool());
                    fieldConstantValueKQ.add(cpConstant);
                } else if (attributes[j] instanceof Signature) {
                    flags |= (1<<19);
                    fieldSignature.add(cpBands.getCPSignature(((Signature)attributes[j]).getSignature()));
                } else if (attributes[j] instanceof Deprecated) {
View Full Code Here

                    result.append(n);
                }

                if (verbose) {
                    // Append a field constant value, if any.
                    ConstantValue cv  = f.getConstantValue();
                    if (cv != null) {
                        result.append(indentString(indent * 2,
                                "Constant value: "));
                        result.append(cv);
                        result.append(n);
View Full Code Here

        final JavaClass javaClass = parser.parse();
        final Field[] fields = javaClass.getFields();
        for (int i = 0; i < fields.length; i++) {
            final Field field = fields[i];
            if (field != null) {
                final ConstantValue cv = field.getConstantValue();
                if (cv != null) {
                    String cvs = cv.toString();
                    //Remove start and end quotes if field is a String
                    if (cvs.startsWith("\"") && cvs.endsWith("\"")) {
                        cvs = cvs.substring(1, cvs.length() - 1);
                    }
                    sb.append(field.getName());
View Full Code Here

        final JavaClass javaClass = parser.parse();
        final Field[] fields = javaClass.getFields();
        for (int i = 0; i < fields.length; i++) {
            final Field field = fields[i];
            if (field != null) {
                final ConstantValue cv = field.getConstantValue();
                if (cv != null) {
                    String cvs = cv.toString();
                    //Remove start and end quotes if field is a String
                    if (cvs.startsWith("\"") && cvs.endsWith("\"")) {
                        cvs = cvs.substring(1, cvs.length() - 1);
                    }
                    sb.append(field.getName());
View Full Code Here

        int name_index = cp.addUtf8(name);
        int signature_index = cp.addUtf8(signature);
        if (value != null) {
            checkType(type);
            int index = addConstant();
            addAttribute(new ConstantValue(cp.addUtf8("ConstantValue"), 2, index, cp
                    .getConstantPool()));
        }
        addAnnotationsAsAttribute(cp);
        return new Field(access_flags, name_index, signature_index, getAttributes(), cp
                .getConstantPool());
View Full Code Here

    @Override
    public void visitField( Field field ) {
        _out.println();
        _out.println("    field = new FieldGen(" + printFlags(field.getAccessFlags()) + ", "
                + printType(field.getSignature()) + ", \"" + field.getName() + "\", _cp);");
        ConstantValue cv = field.getConstantValue();
        if (cv != null) {
            String value = cv.toString();
            _out.println("    field.setInitValue(" + value + ")");
        }
        _out.println("    _cg.addField(field.getField());");
    }
View Full Code Here

TOP

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

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.