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.Method;

public class Util {
    @SuppressWarnings("unchecked")
    public static <T> T getAnnotationDefault(Class<? extends Annotation> annotationClass, String element)
            throws Exception {
        Method method = annotationClass.getMethod(element, (Class[]) null);
        return ((T) method.getDefaultValue());
    }
}