Dela via


IAnnotatedElement.IsAnnotationPresent(Class) Method

Definition

Returns true if an annotation for the specified type is <em>present</em> on this element, else false.

[Android.Runtime.Register("isAnnotationPresent", "(Ljava/lang/Class;)Z", "GetIsAnnotationPresent_Ljava_lang_Class_Handler:Java.Lang.Reflect.IAnnotatedElement, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public virtual bool IsAnnotationPresent (Java.Lang.Class annotationClass);
[<Android.Runtime.Register("isAnnotationPresent", "(Ljava/lang/Class;)Z", "GetIsAnnotationPresent_Ljava_lang_Class_Handler:Java.Lang.Reflect.IAnnotatedElement, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member IsAnnotationPresent : Java.Lang.Class -> bool
override this.IsAnnotationPresent : Java.Lang.Class -> bool

Parameters

annotationClass
Class

the Class object corresponding to the annotation type

Returns

true if an annotation for the specified annotation type is present on this element, else false

Attributes

Remarks

Returns true if an annotation for the specified type is <em>present</em> on this element, else false. This method is designed primarily for convenient access to marker annotations.

The truth value returned by this method is equivalent to: getAnnotation(annotationClass) != null

The body of the default method is specified to be the code above.

Added in 1.5.

Java documentation for java.lang.reflect.AnnotatedElement.isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation>).

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.

Applies to