Util.java Source code

Java tutorial

Introduction

Here is the source code for Util.java

Source

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

public class Util {
    public static boolean isFieldAnnotationPresent(Class<?> clazz, String fieldName,
            Class<? extends Annotation> annotationClass) throws NoSuchFieldException {
        Field field = clazz.getDeclaredField(fieldName);
        return (field.isAnnotationPresent(annotationClass));
    }
}