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

org.python.expose.generate.RestrictiveAnnotationVisitor Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version
package org.python.expose.generate;

import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;

/**
 * An Annotation visitor that throws an IllegalArgumentException if it visits anything other than
 * visitEnd. Should be subclasses by something interested in only certain events.
 */
public class RestrictiveAnnotationVisitor extends AnnotationVisitor {

    public RestrictiveAnnotationVisitor() {
        super(Opcodes.ASM7);
    }

    public AnnotationVisitor visitAnnotation(String name, String desc) {
        throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
    }

    public void visitEnd() {}

    public AnnotationVisitor visitArray(String name) {
        throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
    }

    public void visitEnum(String name, String desc, String value) {
        throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
    }

    public void visit(String name, Object value) {
        throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy