Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ConstantUtf8


                result.append(i);
                result.append(" = ");

                // Append a constant specific string.
                if (constant instanceof ConstantUtf8) {
                    ConstantUtf8 c = (ConstantUtf8) constant;
                    result.append("Asciz\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantFieldref) {
                    ConstantFieldref c = (ConstantFieldref) constant;
                    result.append("Field\t#");
                    result.append(c.getClassIndex());
                    result.append(".#");
                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantNameAndType) {
                    ConstantNameAndType c = (ConstantNameAndType) constant;
                    result.append("NameAndType\t#");
                    result.append(c.getNameIndex());
                    result.append(":#");
                    result.append(c.getSignatureIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantMethodref) {
                    ConstantMethodref c = (ConstantMethodref) constant;
                    result.append("Method\t#");
                    result.append(c.getClassIndex());
                    result.append(".#");
                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantInterfaceMethodref) {
                    ConstantInterfaceMethodref c = (ConstantInterfaceMethodref) constant;
                    result.append("InterfaceMethod\t#");
                    result.append(c.getClassIndex());
                    result.append(".#");
                    result.append(c.getNameAndTypeIndex());
                    result.append(";\t//  ");
                    result.append(Utility.replace(
                            constPool.constantToString(c), " ", ":"));
                } else if (constant instanceof ConstantDouble) {
                    ConstantDouble c = (ConstantDouble) constant;
                    result.append("double\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantFloat) {
                    ConstantFloat c = (ConstantFloat) constant;
                    result.append("float\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantInteger) {
                    ConstantInteger c = (ConstantInteger) constant;
                    result.append("int\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantLong) {
                    ConstantLong c = (ConstantLong) constant;
                    result.append("long\t");
                    result.append(constPool.constantToString(c));
                    result.append(';');
                } else if (constant instanceof ConstantClass) {
                    ConstantClass c = (ConstantClass) constant;
                    result.append("class\t#");
                    result.append(c.getNameIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                } else if (constant instanceof ConstantString) {
                    ConstantString c = (ConstantString) constant;
                    result.append("String\t#");
                    result.append(c.getStringIndex());
                    result.append(";\t//  ");
                    result.append(constPool.constantToString(c));
                }

                result.append(n);
View Full Code Here


  }

  @Override
    public String stringifyValue()
  {
    ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(
        valueIdx);
    return cu8.getBytes();
    // ConstantString cu8 =
    // (ConstantString)getConstantPool().getConstant(valueIdx);
    // return
    // ((ConstantUtf8)getConstantPool().getConstant(cu8.getStringIndex())).getBytes();
  }
View Full Code Here

  }

  public final String getTypeSignature()
  {
    // ConstantClass c = (ConstantClass)cpool.getConstant(typeIndex);
    ConstantUtf8 utf8 = (ConstantUtf8) cpool
        .getConstant(typeIndex/* c.getNameIndex() */);
    return utf8.getBytes();
  }
View Full Code Here

    return idx;
  }

  public String getClassString()
  {
    ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx);
    return cu8.getBytes();
    // ConstantClass c = (ConstantClass)getConstantPool().getConstant(idx);
    // ConstantUtf8 utf8 =
    // (ConstantUtf8)getConstantPool().getConstant(c.getNameIndex());
    // return utf8.getBytes();
  }
View Full Code Here

        final String interfaceName = TransformationUtil.IDENTIFIABLE_INTERFACE;

        boolean addInterface = true;
        for (int i = 0; i < interfaces.length; i++) {
            final ConstantClass cc = (ConstantClass)cpg.getConstant(interfaces[i]);
            final ConstantUtf8 cu = (ConstantUtf8)cpg.getConstant(cc.getNameIndex());

            if (implementsInterface(cu, interfaceName)) {
                addInterface = false;
                break;
            }
View Full Code Here

                String className = (String) iit.next();

                boolean addInterface = true;
                for (int l = 0; l < interfaces.length; l++) {
                    ConstantClass cc = (ConstantClass)cpg.getConstant(interfaces[l]);
                    ConstantUtf8 cu = (ConstantUtf8)cpg.getConstant(cc.getNameIndex());

                    if (implementsInterface(cu, className)) {
                        addInterface = false;
                        break;
                    }
View Full Code Here

            boolean addInterface = true;

            for (int l = 0; l < interfaces.length; l++) {
                ConstantClass cc = (ConstantClass)cpg.getConstant(interfaces[l]);
                ConstantUtf8 cu = (ConstantUtf8)cpg.getConstant(cc.getNameIndex());

                if (IntroductionTransformer.implementsInterface(cu, interfaceName)) {
                    addInterface = false;
                    break;
                }
View Full Code Here

        final String interfaceName = TransformationUtil.META_DATA_INTERFACE;

        boolean addInterface = true;
        for (int i = 0; i < interfaces.length; i++) {
            final ConstantClass cc = (ConstantClass)cpg.getConstant(interfaces[i]);
            final ConstantUtf8 cu = (ConstantUtf8)cpg.getConstant(cc.getNameIndex());

            if (implementsInterface(cu, interfaceName)) {
                addInterface = false;
                break;
            }
View Full Code Here

        final String interfaceName = TransformationUtil.IDENTIFIABLE_INTERFACE;

        boolean addInterface = true;
        for (int i = 0; i < interfaces.length; i++) {
            final ConstantClass cc = (ConstantClass)cpg.getConstant(interfaces[i]);
            final ConstantUtf8 cu = (ConstantUtf8)cpg.getConstant(cc.getNameIndex());

            if (implementsInterface(cu, interfaceName)) {
                addInterface = false;
                break;
            }
View Full Code Here

        final String interfaceName = TransformationUtil.META_DATA_INTERFACE;

        boolean addInterface = true;
        for (int i = 0; i < interfaces.length; i++) {
            final ConstantClass cc = (ConstantClass)cpg.getConstant(interfaces[i]);
            final ConstantUtf8 cu = (ConstantUtf8)cpg.getConstant(cc.getNameIndex());

            if (implementsInterface(cu, interfaceName)) {
                addInterface = false;
                break;
            }
View Full Code Here

TOP

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

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.