Java examples for java.lang.annotation:Annotation Attribute
Check if an AccessibleObject has Annotation
//package com.java2s; import java.lang.annotation.Annotation; import java.lang.reflect.AccessibleObject; public class Main { public static boolean hasAnnotation(AccessibleObject member, Class<? extends Annotation> annotationClass) { Annotation annotation = member.getAnnotation(annotationClass); return annotation != null; }/*from w w w. ja v a 2s . com*/ }