KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > libraries > asm > attrs > RuntimeInvisibleParameterAnnotations


1 /**
2  * ASM: a very small and fast Java bytecode manipulation framework
3  * Copyright (c) 2000,2002,2003 INRIA, France Telecom
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28  * THE POSSIBILITY OF SUCH DAMAGE.
29  */

30
31 package oracle.toplink.libraries.asm.attrs;
32
33 import java.util.ArrayList JavaDoc;
34 import java.util.List JavaDoc;
35
36 import oracle.toplink.libraries.asm.Attribute;
37 import oracle.toplink.libraries.asm.ByteVector;
38 import oracle.toplink.libraries.asm.ClassReader;
39 import oracle.toplink.libraries.asm.ClassWriter;
40 import oracle.toplink.libraries.asm.Label;
41
42
43 /**
44  * The RuntimeInvisibleParameterAnnotations attribute is similar to the
45  * RuntimeVisibleParameterAnnotations attribute, except that the annotations
46  * represented by a RuntimeInvisibleParameterAnnotations attribute must not be
47  * made available for return by reflective APIs, unless the JVM has specifically
48  * been instructed to retain these annotations via some implementation-specific
49  * mechanism such as a command line flag. In the absence of such instructions, the
50  * JVM ignores this attribute.
51  * <p>
52  * The RuntimeInvisibleParameterAnnotations attribute is a variable length
53  * attribute in the attributes table of the method_info structure. The
54  * RuntimeInvisibleParameterAnnotations attribute records runtime-invisible Java
55  * programming language annotations on the parameters of the corresponding method.
56  * Each method_info structure may contain at most one
57  * RuntimeInvisibleParameterAnnotations attribute, which records all the
58  * runtime-invisible Java programming language annotations on the parameters of
59  * the corresponding method.
60  * <p>
61  * The RuntimeInvisibleParameterAnnotations attribute has the following format:
62  * <pre>
63  * RuntimeInvisibleParameterAnnotations_attribute {
64  * u2 attribute_name_index;
65  * u4 attribute_length;
66  * u1 num_parameters;
67  * {
68  * u2 num_annotations;
69  * annotation annotations[num_annotations];
70  * } parameter_annotations[num_parameters];
71  * }
72  * </pre>
73  * The items of the RuntimeInvisibleParameterAnnotations structure are as follows:
74  * <dl>
75  * <dt>attribute_name_index</dt>
76  * <dd>The value of the attribute_name_index item must be a valid index into the
77  * constant_pool table. The constant_pool entry at that index must be a
78  * CONSTANT_Utf8_info structure representing the string
79  * "RuntimeInvisibleParameterAnnotations".</dd>
80  * <dt>attribute_length</dt>
81  * <dd>The value of the attribute_length item indicates the length of the attribute,
82  * excluding the initial six bytes. The value of the attribute_length item is
83  * thus dependent on the number of parameters, the number of runtime-invisible
84  * annotations on each parameter, and their values.</dd>
85  * <dt>num_parameters</dt>
86  * <dd>The value of the num_parameters item gives the number of parameters of the
87  * method represented by the method_info structure on which the annotation
88  * occurs. (This duplicates information that could be extracted from the method
89  * descriptor.)</dd>
90  * <dt>parameter_annotations</dt>
91  * <dd>Each value of the parameter_annotations table represents all of the
92  * runtime-invisible annotations on a single parameter. The sequence of values
93  * in the table corresponds to the sequence of parameters in the method
94  * signature. Each parameter_annotations entry contains the following two items:
95  * <dl>
96  * <dt>num_annotations</dt>
97  * <dd>The value of the num_annotations item indicates the number of
98  * runtime-invisible annotations on the parameter corresponding to the sequence
99  * number of this parameter_annotations element.</dd>
100  * <dt>annotations</dt>
101  * <dd>Each value of the annotations table represents a single runtime-invisible
102  * {@link Annotation annotation} on the parameter corresponding to the sequence
103  * number of this parameter_annotations element.</dd>
104  * </dl>
105  * </dd>
106  * </dl>
107  *
108  * @see <a HREF="http://www.jcp.org/en/jsr/detail?id=175">JSR 175 : A Metadata
109  * Facility for the Java Programming Language</a>
110  *
111  * @author Eugene Kuleshov
112  */

113
114 public class RuntimeInvisibleParameterAnnotations extends Attribute {
115   /**
116    * <code>List</code> of <code>List</code>s that
117    * contains <code>Annotation</code> for each method parameter.
118    *
119    * @associates <{oracle.toplink.libraries.asm.attrs.Annotation}>
120    * @label parameters
121    * @associationAsClass List
122    */

123   public List JavaDoc parameters = new ArrayList JavaDoc();
124
125   public RuntimeInvisibleParameterAnnotations () {
126     super("RuntimeInvisibleParameterAnnotations");
127   }
128
129   protected Attribute read (ClassReader cr, int off,
130                             int len, char[] buf, int codeOff, Label[] labels) {
131     RuntimeInvisibleParameterAnnotations atr =
132       new RuntimeInvisibleParameterAnnotations();
133     Annotation.readParameterAnnotations(atr.parameters, cr, off, buf);
134     return atr;
135   }
136
137   protected ByteVector write (ClassWriter cw, byte[] code,
138                               int len, int maxStack, int maxLocals) {
139     return Annotation.writeParametersAnnotations(
140       new ByteVector(), parameters, cw);
141   }
142
143   public String JavaDoc toString () {
144     return Annotation.stringParameterAnnotations(parameters);
145   }
146 }
147
Popular Tags