IAnnotatedElement.GetDeclaredAnnotation(Class) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
如果該註解直接為 <em>present</em>,否則為 null,則回傳該元素對指定型別的註解。
[Android.Runtime.Register("getDeclaredAnnotation", "(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;", "GetGetDeclaredAnnotation_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? GetDeclaredAnnotation(Java.Lang.Class annotationClass);
[<Android.Runtime.Register("getDeclaredAnnotation", "(Ljava/lang/Class;)Ljava/lang/annotation/Annotation;", "GetGetDeclaredAnnotation_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 GetDeclaredAnnotation : Java.Lang.Class -> Java.Lang.Object
override this.GetDeclaredAnnotation : Java.Lang.Class -> Java.Lang.Object
參數
- annotationClass
- Class
對應註解類型的 Class 物件
傳回
若該元素直接存在於該元素上,則該元素對指定註解類型的註解,否則為空
- 屬性
備註
如果該註解直接為 <em>present</em>,否則為 null,則回傳該元素對指定型別的註解。
此方法忽略繼承的註解。 (若此元素無直接註解,則回傳 null。)
新增於1.8版本。
Java 文件 java.lang.reflect.AnnotatedElement.getDeclaredAnnotation(java.lang.Class<T>)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。