本文整理汇总了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)));
}