Package alt.jiapi.file.ConstantPool

Examples of alt.jiapi.file.ConstantPool.NameAndTypeInfo


    /**
     * Get a name of the reference (e.g. method name or field name).
     */
    public String getName() {
        ConstantPool.Entry entry = cp.get(getIndex());
        NameAndTypeInfo nti = null;

        if (entry instanceof ConstantPool.MethodRefInfo) {
            ConstantPool.MethodRefInfo mri = (ConstantPool.MethodRefInfo)entry;
            nti = mri.getNameAndTypeInfo();
        }
        else if (entry instanceof ConstantPool.FieldRefInfo) {
            ConstantPool.FieldRefInfo fri = (ConstantPool.FieldRefInfo)entry;
            nti = fri.getNameAndTypeInfo();
        }
        else if (entry instanceof ConstantPool.InterfaceMethodRefInfo) {
            ConstantPool.InterfaceMethodRefInfo fri = (ConstantPool.InterfaceMethodRefInfo)entry;
            nti = fri.getNameAndTypeInfo();
  }       
  else {
      System.out.println("Don't know what to do with " + entry);
  }

        return nti.getName();
    }
View Full Code Here


     * Get a signature of the reference (e.g. method's signature or
     * field's signature).
     */
    public String getDescriptor() {
        ConstantPool.Entry entry = cp.get(getIndex());
        NameAndTypeInfo nti = null;

        if (entry instanceof ConstantPool.MethodRefInfo) {
            ConstantPool.MethodRefInfo mri = (ConstantPool.MethodRefInfo)entry;
            nti = mri.getNameAndTypeInfo();
        }
        else if (entry instanceof ConstantPool.FieldRefInfo) {
            ConstantPool.FieldRefInfo fri = (ConstantPool.FieldRefInfo)entry;
            nti = fri.getNameAndTypeInfo();
        }
        else if (entry instanceof ConstantPool.InterfaceMethodRefInfo) {
            ConstantPool.InterfaceMethodRefInfo fri =
                (ConstantPool.InterfaceMethodRefInfo)entry;
            nti = fri.getNameAndTypeInfo();
        }
        else {
            System.out.println(cp);
            System.out.println("Failed to get (interface)Method/Field ref-info from index " + getIndex() + ": " + entry);
            System.out.println("Instruction: " +
                               Opcodes.opcodeStrings[getOpcode()&0xff]);
        }
        return nti.getDescriptor();
    }
View Full Code Here

TOP

Related Classes of alt.jiapi.file.ConstantPool.NameAndTypeInfo

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.