当前位置: 首页>>代码示例>>Java>>正文


Java ConstantPool.getConstantString方法代码示例

本文整理汇总了Java中org.apache.bcel.classfile.ConstantPool.getConstantString方法的典型用法代码示例。如果您正苦于以下问题:Java ConstantPool.getConstantString方法的具体用法?Java ConstantPool.getConstantString怎么用?Java ConstantPool.getConstantString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bcel.classfile.ConstantPool的用法示例。


在下文中一共展示了ConstantPool.getConstantString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClassName

import org.apache.bcel.classfile.ConstantPool; //导入方法依赖的package包/类
/** @return name of the referenced class/interface
 *  @deprecated If the instruction references an array class,
 *    this method will return "java.lang.Object".
 *    For code generated by Java 1.5, this answer is
 *    sometimes wrong (e.g., if the "clone()" method is
 *    called on an array).  A better idea is to use
 *    the getReferenceType() method, which correctly distinguishes
 *    between class types and array types.
 */
public String getClassName( ConstantPoolGen cpg ) {
    ConstantPool cp = cpg.getConstantPool();
    ConstantCP cmr = (ConstantCP) cp.getConstant(index);
    String className = cp.getConstantString(cmr.getClassIndex(),
            org.apache.bcel.Constants.CONSTANT_Class);
    if (className.startsWith("[")) {
        // Turn array classes into java.lang.Object.
        return "java.lang.Object";
    }
    return className.replace('/', '.');
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:21,代码来源:FieldOrMethod.java

示例2: getReferenceType

import org.apache.bcel.classfile.ConstantPool; //导入方法依赖的package包/类
/**
 * Return the reference type representing the class, interface,
 * or array class referenced by the instruction.
 * @param cpg the ConstantPoolGen used to create the instruction
 * @return an ObjectType (if the referenced class type is a class
 *   or interface), or an ArrayType (if the referenced class
 *   type is an array class)
 */
public ReferenceType getReferenceType( ConstantPoolGen cpg ) {
    ConstantPool cp = cpg.getConstantPool();
    ConstantCP cmr = (ConstantCP) cp.getConstant(index);
    String className = cp.getConstantString(cmr.getClassIndex(),
            org.apache.bcel.Constants.CONSTANT_Class);
    if (className.startsWith("[")) {
        return (ArrayType) Type.getType(className);
    } else {
        className = className.replace('/', '.');
        return new ObjectType(className);
    }
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:21,代码来源:FieldOrMethod.java

示例3: getType

import org.apache.bcel.classfile.ConstantPool; //导入方法依赖的package包/类
/** @return type related with this instruction.
 */
public Type getType( ConstantPoolGen cpg ) {
    ConstantPool cp = cpg.getConstantPool();
    String name = cp.getConstantString(index, org.apache.bcel.Constants.CONSTANT_Class);
    if (!name.startsWith("[")) {
        name = "L" + name + ";";
    }
    return Type.getType(name);
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:11,代码来源:CPInstruction.java

示例4: getType

import org.apache.bcel.classfile.ConstantPool; //导入方法依赖的package包/类
/**
 * @return type related with this instruction.
 */
public Type getType(ConstantPoolGen cpg) {
    ConstantPool cp = cpg.getConstantPool();
    String name = cp.getConstantString(index, org.apache.bcel.Constants.CONSTANT_Class);

    if (!name.startsWith("["))
        name = "L" + name + ";";

    return Type.getType(name);
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:13,代码来源:CPInstruction.java


注:本文中的org.apache.bcel.classfile.ConstantPool.getConstantString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。