本文整理汇总了Java中com.sun.org.apache.bcel.internal.generic.Type类的典型用法代码示例。如果您正苦于以下问题:Java Type类的具体用法?Java Type怎么用?Java Type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Type类属于com.sun.org.apache.bcel.internal.generic包,在下文中一共展示了Type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadLocal
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
/**
* Helper method to generate an instance of a subclass of
* {@link LoadInstruction} based on the specified {@link Type} that will
* load the specified local variable
* @param index the JVM stack frame index of the variable that is to be
* loaded
* @param type the {@link Type} of the variable
* @return the generated {@link LoadInstruction}
*/
private static Instruction loadLocal(int index, Type type) {
if (type == Type.BOOLEAN) {
return new ILOAD(index);
} else if (type == Type.INT) {
return new ILOAD(index);
} else if (type == Type.SHORT) {
return new ILOAD(index);
} else if (type == Type.LONG) {
return new LLOAD(index);
} else if (type == Type.BYTE) {
return new ILOAD(index);
} else if (type == Type.CHAR) {
return new ILOAD(index);
} else if (type == Type.FLOAT) {
return new FLOAD(index);
} else if (type == Type.DOUBLE) {
return new DLOAD(index);
} else {
return new ALOAD(index);
}
}
示例2: storeLocal
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
/**
* Helper method to generate an instance of a subclass of
* {@link StoreInstruction} based on the specified {@link Type} that will
* store a value in the specified local variable
* @param index the JVM stack frame index of the variable that is to be
* stored
* @param type the {@link Type} of the variable
* @return the generated {@link StoredInstruction}
*/
private static Instruction storeLocal(int index, Type type) {
if (type == Type.BOOLEAN) {
return new ISTORE(index);
} else if (type == Type.INT) {
return new ISTORE(index);
} else if (type == Type.SHORT) {
return new ISTORE(index);
} else if (type == Type.LONG) {
return new LSTORE(index);
} else if (type == Type.BYTE) {
return new ISTORE(index);
} else if (type == Type.CHAR) {
return new ISTORE(index);
} else if (type == Type.FLOAT) {
return new FSTORE(index);
} else if (type == Type.DOUBLE) {
return new DSTORE(index);
} else {
return new ASTORE(index);
}
}
示例3: CompareGenerator
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public CompareGenerator(int access_flags, Type return_type,
Type[] arg_types, String[] arg_names,
String method_name, String class_name,
InstructionList il, ConstantPoolGen cp) {
super(access_flags, return_type, arg_types, arg_names, method_name,
class_name, il, cp);
_iloadCurrent = new ILOAD(CURRENT_INDEX);
_istoreCurrent = new ISTORE(CURRENT_INDEX);
_aloadDom = new ALOAD(DOM_INDEX);
_iloadLast = new ILOAD(LAST_INDEX);
LocalVariableGen iterator =
addLocalVariable("iterator",
Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
null, null);
ITERATOR_INDEX = iterator.getIndex();
_aloadIterator = new ALOAD(ITERATOR_INDEX);
_astoreIterator = new ASTORE(ITERATOR_INDEX);
il.append(new ACONST_NULL());
il.append(storeIterator());
}
示例4: printType
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
static String printType( final String signature ) {
final Type type = Type.getType(signature);
final byte t = type.getType();
if (t <= Const.T_VOID) {
return "Type." + Const.getTypeName(t).toUpperCase(Locale.ENGLISH);
} else if (type.toString().equals("java.lang.String")) {
return "Type.STRING";
} else if (type.toString().equals("java.lang.Object")) {
return "Type.OBJECT";
} else if (type.toString().equals("java.lang.StringBuffer")) {
return "Type.STRINGBUFFER";
} else if (type instanceof ArrayType) {
final ArrayType at = (ArrayType) type;
return "new ArrayType(" + printType(at.getBasicType()) + ", " + at.getDimensions()
+ ")";
} else {
return "new ObjectType(\"" + Utility.signatureToString(signature, false) + "\")";
}
}
示例5: visitField
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public void visitField(Field obj) {
if (obj.isStatic()) {
// System.out.println("signature "+obj.getSignature());
Type name = Type.getReturnType(obj.getSignature());
if (pdType.equals(name) ||
bdType.equals(name) ||
mdType.equals(name) ||
edType.equals(name)) {
hasDescFields = true;
}
}
}
示例6: AttributeSetMethodGenerator
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public AttributeSetMethodGenerator(String methodName, ClassGenerator classGen) {
super(com.sun.org.apache.bcel.internal.Constants.ACC_PRIVATE,
com.sun.org.apache.bcel.internal.generic.Type.VOID,
argTypes, argNames, methodName,
classGen.getClassName(),
new InstructionList(),
classGen.getConstantPool());
}
示例7: NamedMethodGenerator
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public NamedMethodGenerator(int access_flags, Type return_type,
Type[] arg_types, String[] arg_names,
String method_name, String class_name,
InstructionList il, ConstantPoolGen cp) {
super(access_flags, return_type, arg_types, arg_names, method_name,
class_name, il, cp);
}
示例8: addLocalVariable
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
/**
* Allocates a local variable. If the slot allocator has already been
* initialized, then call addLocalVariable2() so that the new variable
* is known to the allocator. Failing to do this may cause the allocator
* to return a slot that is already in use.
*/
public LocalVariableGen addLocalVariable(String name, Type type,
InstructionHandle start,
InstructionHandle end)
{
LocalVariableGen lvg;
if (_allocatorInit) {
lvg = addLocalVariable2(name, type, start);
} else {
lvg = super.addLocalVariable(name, type, start, end);
getLocalVariableRegistry().registerLocalVariable(lvg);
}
return lvg;
}
示例9: addLocalVariable2
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public LocalVariableGen addLocalVariable2(String name, Type type,
InstructionHandle start)
{
LocalVariableGen lvg = super.addLocalVariable(name, type,
_slotAllocator.allocateSlot(type),
start, null);
getLocalVariableRegistry().registerLocalVariable(lvg);
return lvg;
}
示例10: allocateSlot
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public int allocateSlot(Type type) {
final int size = type.getSize();
final int limit = _free;
int slot = _firstAvailableSlot, where = 0;
if (_free + size > _size) {
final int[] array = new int[_size *= 2];
for (int j = 0; j < limit; j++)
array[j] = _slotsTaken[j];
_slotsTaken = array;
}
while (where < limit) {
if (slot + size <= _slotsTaken[where]) {
// insert
for (int j = limit - 1; j >= where; j--)
_slotsTaken[j + size] = _slotsTaken[j];
break;
}
else {
slot = _slotsTaken[where++] + 1;
}
}
for (int j = 0; j < size; j++)
_slotsTaken[where + j] = slot + j;
_free += size;
return slot;
}
示例11: RtMethodGenerator
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public RtMethodGenerator(int access_flags, Type return_type,
Type[] arg_types, String[] arg_names,
String method_name, String class_name,
InstructionList il, ConstantPoolGen cp) {
super(access_flags, return_type, arg_types, arg_names, method_name,
class_name, il, cp);
_astoreHandler = new ASTORE(HANDLER_INDEX);
_aloadHandler = new ALOAD(HANDLER_INDEX);
}
示例12: MatchGenerator
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public MatchGenerator(int access_flags, Type return_type,
Type[] arg_types, String[] arg_names,
String method_name, String class_name,
InstructionList il, ConstantPoolGen cp) {
super(access_flags, return_type, arg_types, arg_names, method_name,
class_name, il, cp);
_iloadCurrent = new ILOAD(CURRENT_INDEX);
_istoreCurrent = new ISTORE(CURRENT_INDEX);
}
示例13: TestGenerator
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public TestGenerator(int access_flags, Type return_type,
Type[] arg_types, String[] arg_names,
String method_name, String class_name,
InstructionList il, ConstantPoolGen cp) {
super(access_flags, return_type, arg_types, arg_names, method_name,
class_name, il, cp);
_iloadCurrent = new ILOAD(CURRENT_NODE_INDEX);
_istoreCurrent = new ISTORE(CURRENT_NODE_INDEX);
_iloadContext = new ILOAD(CONTEXT_NODE_INDEX);
_istoreContext = new ILOAD(CONTEXT_NODE_INDEX);
_astoreIterator = new ASTORE(ITERATOR_INDEX);
_aloadIterator = new ALOAD(ITERATOR_INDEX);
}
示例14: getMethod
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
/**
* @return A com.sun.org.apache.bcel.internal.classfile.Method corresponding to
* java.lang.reflect.Method if any
*/
public Method getMethod(java.lang.reflect.Method m) {
for(int i = 0; i < methods.length; i++) {
Method method = methods[i];
if(m.getName().equals(method.getName()) &&
(m.getModifiers() == method.getModifiers()) &&
Type.getSignature(m).equals(method.getSignature())) {
return method;
}
}
return null;
}
示例15: AttributeSetMethodGenerator
import com.sun.org.apache.bcel.internal.generic.Type; //导入依赖的package包/类
public AttributeSetMethodGenerator(String methodName, ClassGenerator classGen) {
super(com.sun.org.apache.bcel.internal.Const.ACC_PRIVATE,
com.sun.org.apache.bcel.internal.generic.Type.VOID,
argTypes, argNames, methodName,
classGen.getClassName(),
new InstructionList(),
classGen.getConstantPool());
}