/** * Get the fully qualified class names of all meta-annotation types * <em>present</em> on the annotation (of the specified {@code annotationType}) * on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationType the annotation type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or {@code null} if not found * @since 4.2 * @see #getMetaAnnotationTypes(AnnotatedElement, String) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, Class<? extends Annotation> annotationType) { return getMetaAnnotationTypes(element, element.getAnnotation(annotationType)); }
@Override public Set<String> getMetaAnnotationTypes(String annotationName) { return (this.annotations.length > 0 ? AnnotatedElementUtils.getMetaAnnotationTypes(getIntrospectedClass(), annotationName) : Collections.emptySet()); }
/** * Get the fully qualified class names of all meta-annotation types * <em>present</em> on the annotation (of the specified {@code annotationType}) * on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationType the annotation type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or {@code null} if not found * @since 4.2 * @see #getMetaAnnotationTypes(AnnotatedElement, String) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, Class<? extends Annotation> annotationType) { return getMetaAnnotationTypes(element, element.getAnnotation(annotationType)); }
/** * Get the fully qualified class names of all meta-annotation * types <em>present</em> on the annotation (of the specified * {@code annotationName}) on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationName the fully qualified class name of the annotation * type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or an empty set if none found * @see #getMetaAnnotationTypes(AnnotatedElement, Class) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, String annotationName) { return getMetaAnnotationTypes(element, AnnotationUtils.getAnnotation(element, annotationName)); }
@Override public Set<String> getMetaAnnotationTypes(String annotationName) { return (this.annotations.length > 0 ? AnnotatedElementUtils.getMetaAnnotationTypes(getIntrospectedClass(), annotationName) : Collections.emptySet()); }
/** * Get the fully qualified class names of all meta-annotation * types <em>present</em> on the annotation (of the specified * {@code annotationName}) on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationName the fully qualified class name of the annotation * type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or an empty set if none found * @see #getMetaAnnotationTypes(AnnotatedElement, Class) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, String annotationName) { return getMetaAnnotationTypes(element, AnnotationUtils.getAnnotation(element, annotationName)); }
@Test public void getMetaAnnotationTypesOnNonAnnotatedClass() { assertTrue(getMetaAnnotationTypes(NonAnnotatedClass.class, TransactionalComponent.class).isEmpty()); assertTrue(getMetaAnnotationTypes(NonAnnotatedClass.class, TransactionalComponent.class.getName()).isEmpty()); }
@Test public void getMetaAnnotationTypesOnClassWithMetaDepth2() { Set<String> names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class, ComposedTransactionalComponent.class); assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class, Indexed.class), names); names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class, ComposedTransactionalComponent.class.getName()); assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class, Indexed.class), names); }
@Test public void getMetaAnnotationTypesOnClassWithMetaDepth1() { Set<String> names = getMetaAnnotationTypes(TransactionalComponentClass.class, TransactionalComponent.class); assertEquals(names(Transactional.class, Component.class, Indexed.class), names); names = getMetaAnnotationTypes(TransactionalComponentClass.class, TransactionalComponent.class.getName()); assertEquals(names(Transactional.class, Component.class, Indexed.class), names); }
/** * Get the fully qualified class names of all meta-annotation types * <em>present</em> on the annotation (of the specified {@code annotationType}) * on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationType the annotation type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or {@code null} if not found * @since 4.2 * @see #getMetaAnnotationTypes(AnnotatedElement, String) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, Class<? extends Annotation> annotationType) { return getMetaAnnotationTypes(element, element.getAnnotation(annotationType)); }
/** * Get the fully qualified class names of all meta-annotation types * <em>present</em> on the annotation (of the specified {@code annotationType}) * on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationType the annotation type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or {@code null} if not found * @since 4.2 * @see #getMetaAnnotationTypes(AnnotatedElement, String) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, Class<? extends Annotation> annotationType) { return getMetaAnnotationTypes(element, element.getAnnotation(annotationType)); }
/** * Get the fully qualified class names of all meta-annotation types * <em>present</em> on the annotation (of the specified {@code annotationType}) * on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationType the annotation type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or {@code null} if not found * @since 4.2 * @see #getMetaAnnotationTypes(AnnotatedElement, String) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, Class<? extends Annotation> annotationType) { return getMetaAnnotationTypes(element, element.getAnnotation(annotationType)); }
@Override public Set<String> getMetaAnnotationTypes(String annotationName) { return (this.annotations.length > 0 ? AnnotatedElementUtils.getMetaAnnotationTypes(getIntrospectedClass(), annotationName) : Collections.emptySet()); }
@Override public Set<String> getMetaAnnotationTypes(String annotationName) { return (this.annotations.length > 0 ? AnnotatedElementUtils.getMetaAnnotationTypes(getIntrospectedClass(), annotationName) : Collections.emptySet()); }
/** * Get the fully qualified class names of all meta-annotation * types <em>present</em> on the annotation (of the specified * {@code annotationName}) on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationName the fully qualified class name of the annotation * type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or an empty set if none found * @see #getMetaAnnotationTypes(AnnotatedElement, Class) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, String annotationName) { return getMetaAnnotationTypes(element, AnnotationUtils.getAnnotation(element, annotationName)); }
/** * Get the fully qualified class names of all meta-annotation * types <em>present</em> on the annotation (of the specified * {@code annotationName}) on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationName the fully qualified class name of the annotation * type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or an empty set if none found * @see #getMetaAnnotationTypes(AnnotatedElement, Class) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, String annotationName) { return getMetaAnnotationTypes(element, AnnotationUtils.getAnnotation(element, annotationName)); }
/** * Get the fully qualified class names of all meta-annotation * types <em>present</em> on the annotation (of the specified * {@code annotationName}) on the supplied {@link AnnotatedElement}. * <p>This method follows <em>get semantics</em> as described in the * {@linkplain AnnotatedElementUtils class-level javadoc}. * @param element the annotated element * @param annotationName the fully qualified class name of the annotation * type on which to find meta-annotations * @return the names of all meta-annotations present on the annotation, * or an empty set if none found * @see #getMetaAnnotationTypes(AnnotatedElement, Class) * @see #hasMetaAnnotationTypes */ public static Set<String> getMetaAnnotationTypes(AnnotatedElement element, String annotationName) { return getMetaAnnotationTypes(element, AnnotationUtils.getAnnotation(element, annotationName)); }