本文整理匯總了Java中org.objectweb.asm.commons.Method.getArgumentTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java Method.getArgumentTypes方法的具體用法?Java Method.getArgumentTypes怎麽用?Java Method.getArgumentTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.objectweb.asm.commons.Method
的用法示例。
在下文中一共展示了Method.getArgumentTypes方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: putMethod
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
public void putMethod(MethodRef a, MethodRef b) {
Method descriptor = new Method(b.getMethodName(), b.getMethodDesc());
TypeNameEnforcer returnType = new TypeNameEnforcer(descriptor.getReturnType()
.getClassName());
if (classMappings.containsKey(returnType.getJvmStandard())) {
returnType = new TypeNameEnforcer(classMappings.get(returnType.getJvmStandard()));
}
List<TypeNameEnforcer> parameterTypes = new ArrayList<>();
for (Type type : descriptor.getArgumentTypes()) {
if (classMappings.containsKey(new TypeNameEnforcer(type.getClassName()).getJvmStandard())) {
parameterTypes.add(new TypeNameEnforcer(classMappings.get(new TypeNameEnforcer
(type.getClassName()).getJvmStandard())));
} else {
parameterTypes.add(new TypeNameEnforcer(type.getClassName()));
}
}
MethodRef newB = new MethodRef(b.getClassName(), b.getMethodName(), createDescriptor
(returnType, parameterTypes));
methodMappings.put(a, newB);
}
示例2: MethodDescriptor
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
public MethodDescriptor(String name, String descriptor) {
if (name == null || descriptor == null)
throw new RuntimeException("null");
Method method = new Method(name, descriptor);
List<NameSpecification> arguments = new ArrayList<>();
for (Type type : method.getArgumentTypes()) {
arguments.add(new NameSpecification(type));
}
this.returnType = new NameSpecification(method.getReturnType());
this.arguments = arguments.toArray(new NameSpecification[arguments.size()]);
}
示例3: type
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
@Override
public Type type(Context ctx) {
List<Type> argumentTypes = new ArrayList<>();
for (Expression argument : arguments) {
argumentTypes.add(argument.type(ctx));
}
Set<Method> methods = ctx.getStaticMethods().keySet();
for (Method m : methods) {
if (m.getName().equals(methodName)) {
if (m.getArgumentTypes().length == argumentTypes.size()) {
Type[] methodTypes = m.getArgumentTypes();
boolean isSame = true;
for (int i = 0; i < argumentTypes.size(); i++) {
if (!methodTypes[i].equals(argumentTypes.get(i))) {
isSame = false;
break;
}
}
if (isSame) {
return m.getReturnType();
}
}
}
}
throw new RuntimeException(format("No method %s.%s(%s). %s",
owner.type(ctx).getClassName(),
methodName,
(!argumentTypes.isEmpty() ? argsToString(argumentClasses(ctx, arguments)) : ""),
exceptionInGeneratedClass(ctx)));
}