Example usage for java.lang.reflect AccessibleObject getAnnotationsByType

List of usage examples for java.lang.reflect AccessibleObject getAnnotationsByType

Introduction

In this page you can find the example usage for java.lang.reflect AccessibleObject getAnnotationsByType.

Prototype

@Override
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) 

Source Link

Usage

From source file:com.yahoo.elide.core.EntityDictionary.java

/**
 * Return multiple annotations from field or accessor method.
 *
 * @param <A>   the type parameter
 * @param entityClass the entity class/*from w  w w  . j a  v  a 2  s. c o m*/
 * @param annotationClass given annotation type
 * @param identifier the identifier
 * @return annotation found or null if none found
 */
public <A extends Annotation> A[] getAttributeOrRelationAnnotations(Class<?> entityClass,
        Class<A> annotationClass, String identifier) {
    AccessibleObject fieldOrMethod = entityBinding(entityClass).fieldsToValues.get(identifier);
    if (fieldOrMethod == null) {
        return null;
    }
    return fieldOrMethod.getAnnotationsByType(annotationClass);
}