Interface AnnotationAccessor

    • Method Summary

      Modifier and Type Method Description
      <A extends java.lang.annotation.Annotation>
      @Nullable A
      annotation​(@NonNull java.lang.Class<A> clazz)
      Get an annotation instance, if it's present.
      @NonNull java.util.Collection<@NonNull java.lang.annotation.Annotation> annotations()
      Get an immutable collection containing all of the annotations that are accessible using the annotation accessor
      static @NonNull AnnotationAccessor empty()
      Get a AnnotationAccessor that cannot access any annotations
      static @NonNull AnnotationAccessor of​(@NonNull java.lang.reflect.AnnotatedElement element)
      Get a AnnotationAccessor instance for a AnnotatedElement, such as a Class or a Method.
    • Method Detail

      • of

        static @NonNull AnnotationAccessor of​(@NonNull java.lang.reflect.AnnotatedElement element)
        Get a AnnotationAccessor instance for a AnnotatedElement, such as a Class or a Method. This instance can then be used as a proxy for retrieving the element's annotations
        Parameters:
        element - Annotated element that will be proxied by the accessor
        Returns:
        Annotation accessor proxying the given annotated element
      • annotation

        <A extends java.lang.annotation.Annotation> @Nullable A annotation​(@NonNull java.lang.Class<A> clazz)
        Get an annotation instance, if it's present. If the annotation isn't available, this will return null
        Type Parameters:
        A - Annotation type
        Parameters:
        clazz - Annotation class
        Returns:
        Annotation instance, or null
      • annotations

        @NonNull java.util.Collection<@NonNull java.lang.annotation.Annotation> annotations()
        Get an immutable collection containing all of the annotations that are accessible using the annotation accessor
        Returns:
        Immutable collection of annotations