IAnnotatedElement.GetDeclaredAnnotationsByType(Class) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns this element's annotation(s) for the specified type if such annotations are either <em>directly present</em> or <em>indirectly present</em>.
[Android.Runtime.Register("getDeclaredAnnotationsByType", "(Ljava/lang/Class;)[Ljava/lang/annotation/Annotation;", "GetGetDeclaredAnnotationsByType_Ljava_lang_Class_Handler:Java.Lang.Reflect.IAnnotatedElement, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.annotation.Annotation" })]
public virtual Java.Lang.Object[]? GetDeclaredAnnotationsByType (Java.Lang.Class annotationClass);
[<Android.Runtime.Register("getDeclaredAnnotationsByType", "(Ljava/lang/Class;)[Ljava/lang/annotation/Annotation;", "GetGetDeclaredAnnotationsByType_Ljava_lang_Class_Handler:Java.Lang.Reflect.IAnnotatedElement, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T extends java.lang.annotation.Annotation" })>]
abstract member GetDeclaredAnnotationsByType : Java.Lang.Class -> Java.Lang.Object[]
override this.GetDeclaredAnnotationsByType : Java.Lang.Class -> Java.Lang.Object[]
Parameters
- annotationClass
- Class
the Class object corresponding to the annotation type
Returns
all this element's annotations for the specified annotation type if directly or indirectly present on this element, else an array of length zero
- Attributes
Remarks
Returns this element's annotation(s) for the specified type if such annotations are either <em>directly present</em> or <em>indirectly present</em>. This method ignores inherited annotations.
If there are no specified annotations directly or indirectly present on this element, the return value is an array of length 0.
The difference between this method and #getDeclaredAnnotation(Class)
is that this method detects if its argument is a <em>repeatable annotation type</em> (JLS 9.6), and if so, attempts to find one or more annotations of that type by "looking through" a container annotation if one is present.
The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.
Added in 1.8.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.