本文整理汇总了Java中com.sun.org.apache.bcel.internal.Constants.T_BOOLEAN属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.T_BOOLEAN属性的具体用法?Java Constants.T_BOOLEAN怎么用?Java Constants.T_BOOLEAN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.bcel.internal.Constants
的用法示例。
在下文中一共展示了Constants.T_BOOLEAN属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addConstant
private int addConstant() {
switch(type.getType()) {
case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
case Constants.T_BOOLEAN: case Constants.T_SHORT:
return cp.addInteger(((Integer)value).intValue());
case Constants.T_FLOAT:
return cp.addFloat(((Float)value).floatValue());
case Constants.T_DOUBLE:
return cp.addDouble(((Double)value).doubleValue());
case Constants.T_LONG:
return cp.addLong(((Long)value).longValue());
case Constants.T_REFERENCE:
return cp.addString(((String)value));
default:
throw new RuntimeException("Oops: Unhandled : " + type.getType());
}
}
示例2: createAppend
public Instruction createAppend(Type type) {
byte t = type.getType();
if(isString(type))
return createInvoke(append_mos[0], Constants.INVOKEVIRTUAL);
switch(t) {
case Constants.T_BOOLEAN:
case Constants.T_CHAR:
case Constants.T_FLOAT:
case Constants.T_DOUBLE:
case Constants.T_BYTE:
case Constants.T_SHORT:
case Constants.T_INT:
case Constants.T_LONG
: return createInvoke(append_mos[t], Constants.INVOKEVIRTUAL);
case Constants.T_ARRAY:
case Constants.T_OBJECT:
return createInvoke(append_mos[1], Constants.INVOKEVIRTUAL);
default:
throw new RuntimeException("Oops: No append for this type? " + type);
}
}
示例3: createReturn
/** Create typed return
*/
public static ReturnInstruction createReturn(Type type) {
switch(type.getType()) {
case Constants.T_ARRAY:
case Constants.T_OBJECT: return ARETURN;
case Constants.T_INT:
case Constants.T_SHORT:
case Constants.T_BOOLEAN:
case Constants.T_CHAR:
case Constants.T_BYTE: return IRETURN;
case Constants.T_FLOAT: return FRETURN;
case Constants.T_DOUBLE: return DRETURN;
case Constants.T_LONG: return LRETURN;
case Constants.T_VOID: return RETURN;
default:
throw new RuntimeException("Invalid type: " + type);
}
}
示例4: createStore
/**
* @param index index of local variable
*/
public static LocalVariableInstruction createStore(Type type, int index) {
switch(type.getType()) {
case Constants.T_BOOLEAN:
case Constants.T_CHAR:
case Constants.T_BYTE:
case Constants.T_SHORT:
case Constants.T_INT: return new ISTORE(index);
case Constants.T_FLOAT: return new FSTORE(index);
case Constants.T_DOUBLE: return new DSTORE(index);
case Constants.T_LONG: return new LSTORE(index);
case Constants.T_ARRAY:
case Constants.T_OBJECT: return new ASTORE(index);
default: throw new RuntimeException("Invalid type " + type);
}
}
示例5: createLoad
/**
* @param index index of local variable
*/
public static LocalVariableInstruction createLoad(Type type, int index) {
switch(type.getType()) {
case Constants.T_BOOLEAN:
case Constants.T_CHAR:
case Constants.T_BYTE:
case Constants.T_SHORT:
case Constants.T_INT: return new ILOAD(index);
case Constants.T_FLOAT: return new FLOAD(index);
case Constants.T_DOUBLE: return new DLOAD(index);
case Constants.T_LONG: return new LLOAD(index);
case Constants.T_ARRAY:
case Constants.T_OBJECT: return new ALOAD(index);
default: throw new RuntimeException("Invalid type " + type);
}
}
示例6: createArrayLoad
/**
* @param type type of elements of array, i.e., array.getElementType()
*/
public static ArrayInstruction createArrayLoad(Type type) {
switch(type.getType()) {
case Constants.T_BOOLEAN:
case Constants.T_BYTE: return BALOAD;
case Constants.T_CHAR: return CALOAD;
case Constants.T_SHORT: return SALOAD;
case Constants.T_INT: return IALOAD;
case Constants.T_FLOAT: return FALOAD;
case Constants.T_DOUBLE: return DALOAD;
case Constants.T_LONG: return LALOAD;
case Constants.T_ARRAY:
case Constants.T_OBJECT: return AALOAD;
default: throw new RuntimeException("Invalid type " + type);
}
}
示例7: createArrayStore
/**
* @param type type of elements of array, i.e., array.getElementType()
*/
public static ArrayInstruction createArrayStore(Type type) {
switch(type.getType()) {
case Constants.T_BOOLEAN:
case Constants.T_BYTE: return BASTORE;
case Constants.T_CHAR: return CASTORE;
case Constants.T_SHORT: return SASTORE;
case Constants.T_INT: return IASTORE;
case Constants.T_FLOAT: return FASTORE;
case Constants.T_DOUBLE: return DASTORE;
case Constants.T_LONG: return LASTORE;
case Constants.T_ARRAY:
case Constants.T_OBJECT: return AASTORE;
default: throw new RuntimeException("Invalid type " + type);
}
}
示例8: createNull
/** Create "null" value for reference types, 0 for basic types like int
*/
public static Instruction createNull(Type type) {
switch(type.getType()) {
case Constants.T_ARRAY:
case Constants.T_OBJECT: return ACONST_NULL;
case Constants.T_INT:
case Constants.T_SHORT:
case Constants.T_BOOLEAN:
case Constants.T_CHAR:
case Constants.T_BYTE: return ICONST_0;
case Constants.T_FLOAT: return FCONST_0;
case Constants.T_DOUBLE: return DCONST_0;
case Constants.T_LONG: return LCONST_0;
case Constants.T_VOID: return NOP;
default:
throw new RuntimeException("Invalid type: " + type);
}
}
示例9: getType
public static final BasicType getType(byte type) {
switch(type) {
case Constants.T_VOID: return VOID;
case Constants.T_BOOLEAN: return BOOLEAN;
case Constants.T_BYTE: return BYTE;
case Constants.T_SHORT: return SHORT;
case Constants.T_CHAR: return CHAR;
case Constants.T_INT: return INT;
case Constants.T_LONG: return LONG;
case Constants.T_DOUBLE: return DOUBLE;
case Constants.T_FLOAT: return FLOAT;
default:
throw new ClassGenException("Invalid type: " + type);
}
}
示例10: typeOfSignature
/**
* Return type of signature as a byte value as defined in <em>Constants</em>
*
* @param signature in format described above
* @return type of signature
* @see Constants
*/
public static final byte typeOfSignature(String signature)
throws ClassFormatException
{
try {
switch(signature.charAt(0)) {
case 'B' : return Constants.T_BYTE;
case 'C' : return Constants.T_CHAR;
case 'D' : return Constants.T_DOUBLE;
case 'F' : return Constants.T_FLOAT;
case 'I' : return Constants.T_INT;
case 'J' : return Constants.T_LONG;
case 'L' : return Constants.T_REFERENCE;
case '[' : return Constants.T_ARRAY;
case 'V' : return Constants.T_VOID;
case 'Z' : return Constants.T_BOOLEAN;
case 'S' : return Constants.T_SHORT;
default:
throw new ClassFormatException("Invalid method signature: " + signature);
}
} catch(StringIndexOutOfBoundsException e) {
throw new ClassFormatException("Invalid method signature: " + signature);
}
}
示例11: BasicType
/**
* Constructor for basic types such as int, long, `void'
*
* @param type one of T_INT, T_BOOLEAN, ..., T_VOID
* @see com.sun.org.apache.bcel.internal.Constants
*/
BasicType(byte type) {
super(type, Constants.SHORT_TYPE_NAMES[type]);
if((type < Constants.T_BOOLEAN) || (type > Constants.T_VOID))
throw new ClassGenException("Invalid type: " + type);
}
示例12: getSignature
/** Parse Java type such as "char", or "java.lang.String[]" and return the
* signature in byte code format, e.g. "C" or "[Ljava/lang/String;" respectively.
*
* @param type Java type
* @return byte code signature
*/
public static String getSignature(String type) {
StringBuffer buf = new StringBuffer();
char[] chars = type.toCharArray();
boolean char_found = false, delim = false;
int index = -1;
loop:
for(int i=0; i < chars.length; i++) {
switch(chars[i]) {
case ' ': case '\t': case '\n': case '\r': case '\f':
if(char_found)
delim = true;
break;
case '[':
if(!char_found)
throw new RuntimeException("Illegal type: " + type);
index = i;
break loop;
default:
char_found = true;
if(!delim)
buf.append(chars[i]);
}
}
int brackets = 0;
if(index > 0)
brackets = countBrackets(type.substring(index));
type = buf.toString();
buf.setLength(0);
for(int i=0; i < brackets; i++)
buf.append('[');
boolean found = false;
for(int i=Constants.T_BOOLEAN; (i <= Constants.T_VOID) && !found; i++) {
if(Constants.TYPE_NAMES[i].equals(type)) {
found = true;
buf.append(Constants.SHORT_TYPE_NAMES[i]);
}
}
if(!found) // Class name
buf.append('L' + type.replace('.', '/') + ';');
return buf.toString();
}