本文整理汇总了Java中scouter.javassist.bytecode.ConstPool.CONST_Float方法的典型用法代码示例。如果您正苦于以下问题:Java ConstPool.CONST_Float方法的具体用法?Java ConstPool.CONST_Float怎么用?Java ConstPool.CONST_Float使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scouter.javassist.bytecode.ConstPool
的用法示例。
在下文中一共展示了ConstPool.CONST_Float方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doLDC
import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
private void doLDC(int index) {
TypeData[] stackTypes = this.stackTypes;
int tag = cpool.getTag(index);
if (tag == ConstPool.CONST_String)
stackTypes[stackTop++] = new TypeData.ClassName("java.lang.String");
else if (tag == ConstPool.CONST_Integer)
stackTypes[stackTop++] = INTEGER;
else if (tag == ConstPool.CONST_Float)
stackTypes[stackTop++] = FLOAT;
else if (tag == ConstPool.CONST_Long) {
stackTypes[stackTop++] = LONG;
stackTypes[stackTop++] = TOP;
}
else if (tag == ConstPool.CONST_Double) {
stackTypes[stackTop++] = DOUBLE;
stackTypes[stackTop++] = TOP;
}
else if (tag == ConstPool.CONST_Class)
stackTypes[stackTop++] = new TypeData.ClassName("java.lang.Class");
else
throw new RuntimeException("bad LDC: " + tag);
}
示例2: getConstantValue
import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
/**
* Returns the value of this field if it is a constant field.
* This method works only if the field type is a primitive type
* or <code>String</code> type. Otherwise, it returns <code>null</code>.
* A constant field is <code>static</code> and <code>final</code>.
*
* @return a <code>Integer</code>, <code>Long</code>, <code>Float</code>,
* <code>Double</code>, <code>Boolean</code>,
* or <code>String</code> object
* representing the constant value.
* <code>null</code> if it is not a constant field
* or if the field type is not a primitive type
* or <code>String</code>.
*/
public Object getConstantValue() {
// When this method is modified,
// see also getConstantFieldValue() in TypeChecker.
int index = fieldInfo.getConstantValue();
if (index == 0)
return null;
ConstPool cp = fieldInfo.getConstPool();
switch (cp.getTag(index)) {
case ConstPool.CONST_Long :
return new Long(cp.getLongInfo(index));
case ConstPool.CONST_Float :
return new Float(cp.getFloatInfo(index));
case ConstPool.CONST_Double :
return new Double(cp.getDoubleInfo(index));
case ConstPool.CONST_Integer :
int value = cp.getIntegerInfo(index);
// "Z" means boolean type.
if ("Z".equals(fieldInfo.getDescriptor()))
return new Boolean(value != 0);
else
return new Integer(value);
case ConstPool.CONST_String :
return cp.getStringInfo(index);
default :
throw new RuntimeException("bad tag: " + cp.getTag(index)
+ " at " + index);
}
}
示例3: evalLDC
import scouter.javassist.bytecode.ConstPool; //导入方法依赖的package包/类
private void evalLDC(int index, Frame frame) throws BadBytecode {
int tag = constPool.getTag(index);
Type type;
switch (tag) {
case ConstPool.CONST_String:
type = STRING_TYPE;
break;
case ConstPool.CONST_Integer:
type = Type.INTEGER;
break;
case ConstPool.CONST_Float:
type = Type.FLOAT;
break;
case ConstPool.CONST_Long:
type = Type.LONG;
break;
case ConstPool.CONST_Double:
type = Type.DOUBLE;
break;
case ConstPool.CONST_Class:
type = CLASS_TYPE;
break;
default:
throw new BadBytecode("bad LDC [pos = " + lastPos + "]: " + tag);
}
simplePush(type, frame);
}