< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/FieldVisitor.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch


  52  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  53  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  54  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  55  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  56  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  57  * THE POSSIBILITY OF SUCH DAMAGE.
  58  */
  59 package jdk.internal.org.objectweb.asm;
  60 
  61 /**
  62  * A visitor to visit a Java field. The methods of this class must be called in
  63  * the following order: ( <tt>visitAnnotation</tt> |
  64  * <tt>visitTypeAnnotation</tt> | <tt>visitAttribute</tt> )* <tt>visitEnd</tt>.
  65  *
  66  * @author Eric Bruneton
  67  */
  68 public abstract class FieldVisitor {
  69 
  70     /**
  71      * The ASM API version implemented by this visitor. The value of this field
  72      * must be one of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
  73      */
  74     protected final int api;
  75 
  76     /**
  77      * The field visitor to which this visitor must delegate method calls. May
  78      * be null.
  79      */
  80     protected FieldVisitor fv;
  81 
  82     /**
  83      * Constructs a new {@link FieldVisitor}.
  84      *
  85      * @param api
  86      *            the ASM API version implemented by this visitor. Must be one
  87      *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
  88      */
  89     public FieldVisitor(final int api) {
  90         this(api, null);
  91     }
  92 
  93     /**
  94      * Constructs a new {@link FieldVisitor}.
  95      *
  96      * @param api
  97      *            the ASM API version implemented by this visitor. Must be one
  98      *            of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
  99      * @param fv
 100      *            the field visitor to which this visitor must delegate method
 101      *            calls. May be null.
 102      */
 103     public FieldVisitor(final int api, final FieldVisitor fv) {
 104         if (api != Opcodes.ASM4 && api != Opcodes.ASM5) {
 105             throw new IllegalArgumentException();
 106         }
 107         this.api = api;
 108         this.fv = fv;
 109     }
 110 
 111     /**
 112      * Visits an annotation of the field.
 113      *
 114      * @param desc
 115      *            the class descriptor of the annotation class.
 116      * @param visible
 117      *            <tt>true</tt> if the annotation is visible at runtime.
 118      * @return a visitor to visit the annotation values, or <tt>null</tt> if
 119      *         this visitor is not interested in visiting this annotation.
 120      */
 121     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
 122         if (fv != null) {
 123             return fv.visitAnnotation(desc, visible);
 124         }




  52  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  53  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  54  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  55  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  56  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  57  * THE POSSIBILITY OF SUCH DAMAGE.
  58  */
  59 package jdk.internal.org.objectweb.asm;
  60 
  61 /**
  62  * A visitor to visit a Java field. The methods of this class must be called in
  63  * the following order: ( <tt>visitAnnotation</tt> |
  64  * <tt>visitTypeAnnotation</tt> | <tt>visitAttribute</tt> )* <tt>visitEnd</tt>.
  65  *
  66  * @author Eric Bruneton
  67  */
  68 public abstract class FieldVisitor {
  69 
  70     /**
  71      * The ASM API version implemented by this visitor. The value of this field
  72      * must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
  73      */
  74     protected final int api;
  75 
  76     /**
  77      * The field visitor to which this visitor must delegate method calls. May
  78      * be null.
  79      */
  80     protected FieldVisitor fv;
  81 
  82     /**
  83      * Constructs a new {@link FieldVisitor}.
  84      *
  85      * @param api
  86      *            the ASM API version implemented by this visitor. Must be one
  87      *            of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
  88      */
  89     public FieldVisitor(final int api) {
  90         this(api, null);
  91     }
  92 
  93     /**
  94      * Constructs a new {@link FieldVisitor}.
  95      *
  96      * @param api
  97      *            the ASM API version implemented by this visitor. Must be one
  98      *            of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
  99      * @param fv
 100      *            the field visitor to which this visitor must delegate method
 101      *            calls. May be null.
 102      */
 103     public FieldVisitor(final int api, final FieldVisitor fv) {
 104         if (api < Opcodes.ASM4 || api > Opcodes.ASM6) {
 105             throw new IllegalArgumentException();
 106         }
 107         this.api = api;
 108         this.fv = fv;
 109     }
 110 
 111     /**
 112      * Visits an annotation of the field.
 113      *
 114      * @param desc
 115      *            the class descriptor of the annotation class.
 116      * @param visible
 117      *            <tt>true</tt> if the annotation is visible at runtime.
 118      * @return a visitor to visit the annotation values, or <tt>null</tt> if
 119      *         this visitor is not interested in visiting this annotation.
 120      */
 121     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
 122         if (fv != null) {
 123             return fv.visitAnnotation(desc, visible);
 124         }


< prev index next >