Example usage for org.objectweb.asm.tree ParameterNode accept

List of usage examples for org.objectweb.asm.tree ParameterNode accept

Introduction

In this page you can find the example usage for org.objectweb.asm.tree ParameterNode accept.

Prototype

public void accept(final MethodVisitor methodVisitor) 

Source Link

Document

Makes the given visitor visit this parameter declaration.

Usage

From source file:org.jephyr.activeobject.instrument.ActiveObjectClassAdapter.java

License:Open Source License

private static void acceptAllBeforeCode(MethodNode methodNode, MethodVisitor mv) {
    if (methodNode.parameters != null) {
        for (ParameterNode node : methodNode.parameters) {
            node.accept(mv);
        }/* w w  w.  j  a  v a2s.co m*/
    }

    if (methodNode.annotationDefault != null) {
        AnnotationVisitor av = mv.visitAnnotationDefault();
        if (av != null) {
            acceptAnnotation(av, null, methodNode.annotationDefault);
            av.visitEnd();
        }
    }

    if (methodNode.visibleAnnotations != null) {
        for (AnnotationNode node : methodNode.visibleAnnotations) {
            node.accept(mv.visitAnnotation(node.desc, true));
        }
    }

    if (methodNode.invisibleAnnotations != null) {
        for (AnnotationNode node : methodNode.invisibleAnnotations) {
            node.accept(mv.visitAnnotation(node.desc, false));
        }
    }

    if (methodNode.visibleTypeAnnotations != null) {
        for (TypeAnnotationNode node : methodNode.visibleTypeAnnotations) {
            node.accept(mv.visitTypeAnnotation(node.typeRef, node.typePath, node.desc, true));
        }
    }

    if (methodNode.invisibleTypeAnnotations != null) {
        for (TypeAnnotationNode node : methodNode.invisibleTypeAnnotations) {
            node.accept(mv.visitTypeAnnotation(node.typeRef, node.typePath, node.desc, false));
        }
    }

    if (methodNode.visibleParameterAnnotations != null) {
        int parameter = 0;
        for (List<AnnotationNode> nodes : methodNode.visibleParameterAnnotations) {
            if (nodes != null) {
                for (AnnotationNode node : nodes) {
                    node.accept(mv.visitParameterAnnotation(parameter, node.desc, true));
                }
            }
            parameter++;
        }
    }

    if (methodNode.invisibleParameterAnnotations != null) {
        int parameter = 0;
        for (List<AnnotationNode> nodes : methodNode.invisibleParameterAnnotations) {
            if (nodes != null) {
                for (AnnotationNode node : nodes) {
                    node.accept(mv.visitParameterAnnotation(parameter, node.desc, false));
                }
            }
            parameter++;
        }
    }

    if (methodNode.attrs != null) {
        for (Attribute attribute : methodNode.attrs) {
            mv.visitAttribute(attribute);
        }
    }
}