Interface Annotated

All Known Subinterfaces:
TypedElementInfo, io.helidon.common.types.TypedElementInfoBlueprint, TypeInfo, io.helidon.common.types.TypeInfoBlueprint
All Known Implementing Classes:
TypedElementInfo.BuilderBase.TypedElementInfoImpl, TypeInfo.BuilderBase.TypeInfoImpl

public interface Annotated
Annotated elements provide annotations and their values.
  • Method Details

    • annotations

      List<Annotation> annotations()
      List of declared and known annotations for this element. Note that "known" implies that the annotation is visible, which depends upon the context in which it was build (such as the of the annotation).
      Returns:
      the list of annotations declared on this element
    • inheritedAnnotations

      List<Annotation> inheritedAnnotations()
      List of all inherited annotations for this element. Inherited annotations are annotations declared on annotations of this element that are also marked as Inherited.

      The returned list does not contain annotations(). If a meta-annotation is present on multiple annotations, it will be returned once for each such declaration.

      Returns:
      list of all meta annotations of this element
    • allAnnotations

      default List<Annotation> allAnnotations()
      List of all annotations - both annotations() and inheritedAnnotations().
      Returns:
      list of all annotations valid for this element
    • findAnnotation

      default Optional<Annotation> findAnnotation(TypeName annotationType)
      Find an annotation on this annotated type.
      Parameters:
      annotationType - annotation type
      Returns:
      annotation with value (if found)
    • annotation

      default Annotation annotation(TypeName annotationType)
      Get an annotation on this annotated type.
      Parameters:
      annotationType - annotation type
      Returns:
      annotation with value
      Throws:
      NoSuchElementException - if the annotation is not present on this element
      See Also:
    • hasAnnotation

      default boolean hasAnnotation(TypeName annotationType)
      Check if the annotation exists on this annotated.
      Parameters:
      annotationType - type of annotation to find
      Returns:
      true if the annotation exists on this annotated component