Java examples for java.lang.annotation:Field Annotation
is method or field Annotated
/*// www .j a va 2 s . c om * JFox - The most lightweight Java EE Application Server! * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn. * * JFox is licenced and re-distributable under GNU LGPL. */ //package com.java2s; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Field; public class Main { public static boolean isAnnotated(Method method, Class<? extends Annotation> annotation) { return method.isAnnotationPresent(annotation); } public static boolean isAnnotated(Field field, Class<? extends Annotation> annotation) { return field.isAnnotationPresent(annotation); } }