147 * @see MirroredTypesException |
147 * @see MirroredTypesException |
148 */ |
148 */ |
149 <A extends Annotation> A getAnnotation(Class<A> annotationType); |
149 <A extends Annotation> A getAnnotation(Class<A> annotationType); |
150 |
150 |
151 /** |
151 /** |
152 * Returns an array of all of this element's annotation for the |
152 * Returns annotations that are <em>present</em> on this element. |
153 * specified type if such annotations are present, else an empty |
153 * |
154 * array. The annotation may be either inherited or directly |
154 * If there are no annotations <em>present</em> on this element, the return |
155 * present on this element. This method will look through a container |
155 * value is an array of length 0. |
156 * annotation (if present) if the supplied annotation type is |
156 * |
157 * repeatable. |
157 * The difference between this method and {@link #getAnnotation(Class)} |
|
158 * is that this method detects if its argument is a <em>repeatable |
|
159 * annotation type</em> (JLS 9.6), and if so, attempts to find one or more |
|
160 * annotations of that type by "looking through" a container annotation. |
158 * |
161 * |
159 * <p> The annotations returned by this method could contain an element |
162 * <p> The annotations returned by this method could contain an element |
160 * whose value is of type {@code Class}. |
163 * whose value is of type {@code Class}. |
161 * This value cannot be returned directly: information necessary to |
164 * This value cannot be returned directly: information necessary to |
162 * locate and load a class (such as the class loader to use) is |
165 * locate and load a class (such as the class loader to use) is |
187 * @return this element's annotations for the specified annotation |
190 * @return this element's annotations for the specified annotation |
188 * type if present on this element, else an empty array |
191 * type if present on this element, else an empty array |
189 * |
192 * |
190 * @see #getAnnotationMirrors() |
193 * @see #getAnnotationMirrors() |
191 * @see #getAnnotation(java.lang.Class) |
194 * @see #getAnnotation(java.lang.Class) |
192 * @see java.lang.reflect.AnnotatedElement#getAnnotations |
195 * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType |
193 * @see EnumConstantNotPresentException |
196 * @see EnumConstantNotPresentException |
194 * @see AnnotationTypeMismatchException |
197 * @see AnnotationTypeMismatchException |
195 * @see IncompleteAnnotationException |
198 * @see IncompleteAnnotationException |
196 * @see MirroredTypeException |
199 * @see MirroredTypeException |
197 * @see MirroredTypesException |
200 * @see MirroredTypesException |
198 */ |
201 */ |
199 <A extends Annotation> A[] getAnnotations(Class<A> annotationType); |
202 <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType); |
200 |
203 |
201 /** |
204 /** |
202 * Returns the modifiers of this element, excluding annotations. |
205 * Returns the modifiers of this element, excluding annotations. |
203 * Implicit modifiers, such as the {@code public} and {@code static} |
206 * Implicit modifiers, such as the {@code public} and {@code static} |
204 * modifiers of interface members, are included. |
207 * modifiers of interface members, are included. |