Here you can find the source of getAnnotationMetaAnnotated( AnnotatedElement annotatedElementClass, Class
Parameter | Description |
---|---|
T | the annotation type to retrieve |
annotatedElementClass | the annotated element |
metaAnnotationToFind | the meta annotation to find |
public static <T extends Annotation> Annotation getAnnotationMetaAnnotated( AnnotatedElement annotatedElementClass, Class<T> metaAnnotationToFind)
//package com.java2s; /**/*from w ww .j ava2 s. c om*/ * Copyright (c) 2013-2015 by The SeedStack authors. All rights reserved. * * This file is part of SeedStack, An enterprise-oriented full development stack. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; public class Main { /** * Finds a annotation meta-annotated on the given annotated element. * * @param <T> the annotation type to retrieve * @param annotatedElementClass the annotated element * @param metaAnnotationToFind the meta annotation to find * @return the annotation meta annotated if exist, null otherwise */ public static <T extends Annotation> Annotation getAnnotationMetaAnnotated( AnnotatedElement annotatedElementClass, Class<T> metaAnnotationToFind) { Annotation[] annotations = annotatedElementClass.getAnnotations(); for (Annotation annotation : annotations) { Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); for (Annotation metaAnnotation : metaAnnotations) { if (metaAnnotation.annotationType().equals(metaAnnotationToFind)) { return annotation; } } } return null; } }