All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.paralleluniverse.fibers.instrument.FindAnnotatedMethods Maven / Gradle / Ivy

Go to download

The core library for Fibers on Java, compatible with Java 11-16. Forked from puniverse/quasar

There is a newer version: 10.0.6
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.paralleluniverse.fibers.instrument;

import java.lang.annotation.Annotation;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Type;

/**
 *
 * @author pron
 */
public class FindAnnotatedMethods extends ClassVisitor {
    private final String annotation;
    
    public FindAnnotatedMethods(int api, Class annotation) {
        super(api);
        this.annotation = Type.getDescriptor(annotation);
    }

    private void foo(int access, String name, String desc, String signature, String[] exceptions) {
        
    }
    
    @Override
    public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) {
        return new MethodVisitor(api) {

            @Override
            public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
                if(annotation.equals(desc))
                    foo(access, name, desc, signature, exceptions);
                return null;
            }
            
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy