本文整理汇总了Java中org.apache.bcel.generic.Type.OBJECT属性的典型用法代码示例。如果您正苦于以下问题:Java Type.OBJECT属性的具体用法?Java Type.OBJECT怎么用?Java Type.OBJECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.bcel.generic.Type
的用法示例。
在下文中一共展示了Type.OBJECT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateEqualsMethod
private void generateEqualsMethod(String generatedClassName) {
/* public boolean equals(Object o) {
* return stubHelper.isEquals(this,o);
* }
*/
InstructionList il = new InstructionList();
MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.BOOLEAN, new Type[]{Type.OBJECT}, new String[]{"arg0"}, "equals", generatedClassName, il, constantsPool);
il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
il.append(factory.createFieldAccess(generatedClassName, "stubHelper", new ObjectType("org.codehaus.jremoting.client.StubHelper"), Constants.GETFIELD));
il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
il.append(factory.createInvoke("org.codehaus.jremoting.client.StubHelper", "isEquals", Type.BOOLEAN, new Type[]{Type.OBJECT, Type.OBJECT}, Constants.INVOKEINTERFACE));
il.append(InstructionFactory.createReturn(Type.INT));
method.setMaxStack();
method.setMaxLocals();
classGen.addMethod(method.getMethod());
il.dispose();
}
示例2: createGetReferenceIDMethod
/**
* Add method
* <pre>
* public Long jRemotingGetReferenceID(Object factoryThatIsAsking) {
* return stubHelper.getReference(factoryThatIsAsking);
* }
* </pre>
*
* @param generatedClassName the generated class name
*/
protected void createGetReferenceIDMethod(String generatedClassName) {
InstructionList il = new InstructionList();
MethodGen method = new MethodGen(Constants.ACC_PUBLIC, new ObjectType("java.lang.Long"), new Type[]{Type.OBJECT}, new String[]{"arg0"}, "jRemotingGetReferenceID", generatedClassName, il, constantsPool);
il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
il.append(factory.createFieldAccess(generatedClassName, "stubHelper", new ObjectType("org.codehaus.jremoting.client.StubHelper"), Constants.GETFIELD));
il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
il.append(factory.createInvoke("org.codehaus.jremoting.client.StubHelper", "getReference", new ObjectType("java.lang.Long"), new Type[]{Type.OBJECT}, Constants.INVOKEINTERFACE));
il.append(InstructionFactory.createReturn(Type.OBJECT));
method.setMaxStack();
method.setMaxLocals();
classGen.addMethod(method.getMethod());
il.dispose();
}
示例3: computeFirstCommonSuperclassOfReferenceTypes
private ReferenceType computeFirstCommonSuperclassOfReferenceTypes(ReferenceType a, ReferenceType b)
throws ClassNotFoundException {
boolean aIsArrayType = (a instanceof ArrayType);
boolean bIsArrayType = (b instanceof ArrayType);
if (aIsArrayType && bIsArrayType) {
// Merging array types - kind of a pain.
ArrayType aArrType = (ArrayType) a;
ArrayType bArrType = (ArrayType) b;
if (aArrType.getDimensions() == bArrType.getDimensions()) {
return computeFirstCommonSuperclassOfSameDimensionArrays(aArrType, bArrType);
} else {
return computeFirstCommonSuperclassOfDifferentDimensionArrays(aArrType, bArrType);
}
}
if (aIsArrayType || bIsArrayType) {
// One of a and b is an array type, but not both.
// Common supertype is Object.
return Type.OBJECT;
}
// Neither a nor b is an array type.
// Find first common supertypes of ObjectTypes.
return getFirstCommonSuperclass((ObjectType) a, (ObjectType) b);
}
示例4: instrument_reflection
private static Method instrument_reflection(InstructionFactory inf, MethodGen mgen, ConstantPoolGen cpgen) {
Method ret = mgen.getMethod();
InstructionList ilist = mgen.getInstructionList();
if (ilist == null || ilist.size() == 0)
return ret;
InstructionHandle[] ihdls = ilist.getInstructionHandles();
for (InstructionHandle ihdl : ihdls) {
Instruction instr = ihdl.getInstruction();
// go through all instructions and look for invokes
if (instr instanceof InvokeInstruction) {
InvokeInstruction invoke = (InvokeInstruction) instr;
ReferenceType rtype = invoke.getReferenceType(cpgen);
if (rtype instanceof ObjectType) {
String cname = ((ObjectType) rtype).getClassName();
String mname = invoke.getName(cpgen);
// we look for exact match
if (cname.equals("java.lang.reflect.Method") && mname.equals("invoke")) {
// Util.log(rtype.toString());
Type[] arg_types = { new ObjectType(java.lang.reflect.Method.class.getCanonicalName()), Type.OBJECT, new ArrayType(Type.OBJECT, 1) };
ihdl.setInstruction(inf.createInvoke(SIFAStub.class.getCanonicalName(), "invoke", Type.OBJECT, arg_types, Constants.INVOKESTATIC));
}
} else {
// reference type can be ArrayType or UninitializedObjectType
}
}
}
ilist.setPositions();
mgen.setInstructionList(ilist);
mgen.removeLineNumbers();
mgen.setMaxStack();
mgen.setMaxLocals();
ret = mgen.getMethod();
return ret;
}
示例5: produce
@Override
public ReferenceType produce(GenericObjectType obj) {
return Type.OBJECT;
}