Java 类org.objectweb.asm.tree.ParameterNode 实例源码

项目:astava    文件:ASMClassDeclaration.java   
public static MethodDeclaration getMethod(MethodNode methodNode) {
    return new MethodDeclaration() {
        @Override
        public int getModifier() {
            return methodNode.access;
        }

        @Override
        public String getName() {
            return methodNode.name;
        }

        @Override
        public List<ParameterInfo> getParameterTypes() {
            Type[] argumentTypes = Type.getArgumentTypes(methodNode.desc);
            return IntStream.range(0, argumentTypes.length).mapToObj(i -> new ParameterInfo(
                argumentTypes[i].getDescriptor(),
                methodNode.parameters != null ? ((ParameterNode)methodNode.parameters.get(i)).name : "arg" + i
            )).collect(Collectors.toList());
        }

        @Override
        public String getReturnTypeName() {
            return Descriptor.getName(Type.getReturnType(methodNode.desc).getDescriptor());
        }

        @Override
        public MethodDom build(ClassDeclaration classDeclaration, ClassInspector classInspector) {
            return null;
        }
    };
}
项目:joogle    文件:TypeUtil.java   
public static String getParams(MethodNode m) {
    List<ParameterNode> params = m.parameters;
    if (params == null || params.isEmpty())
        return "()";
    StringBuilder sb = new StringBuilder();
    for (ParameterNode p : params) {
        sb.append(p.name + ", ");
    }
    return '(' + sb.toString() + ')';
}