Class AnnotationFunctions

java.lang.Object
org.eclipse.edc.plugins.autodoc.core.processor.compiler.AnnotationFunctions

public class AnnotationFunctions extends Object
Contains convenience methods for working with Java Compiler API annotation mirrors.

These methods delegate to SimpleAnnotationValueVisitor9 implementations to walk trees produced by the compiler and resolve requested values.

  • Method Details

    • mirrorFor

      @Nullable public static @Nullable AnnotationMirror mirrorFor(Class<? extends Annotation> type, Element element)
      Returns the annotation mirror for the annotated element corresponding to the given annotation type, or null if no type is found.
    • mirrorForReturn

      public static TypeMirror mirrorForReturn(Element element)
      Returns the type mirror for a method's return type. Assumes that element refers to an executable type, most likely a Type$MethodType
    • attributeValue

      public static <T> T attributeValue(Class<T> type, String name, AnnotationMirror annotationMirror, Elements elementUtils)
      Returns the annotation attribute value of the given type and name.
      Parameters:
      type - the value type
      name - the attribute name
      annotationMirror - the annotation
      elementUtils - the current elements instance
    • attributeStringValues

      public static List<String> attributeStringValues(String name, AnnotationMirror annotationMirror, Elements elementUtils)
      Returns the annotation attribute value as a collection of strings.
      Parameters:
      name - the attribute name
      annotationMirror - the annotation
      elementUtils - the current elements instance
    • attributeTypeValues

      public static List<String> attributeTypeValues(String name, AnnotationMirror annotationMirror, Elements elementUtils)
      Returns the annotation attribute value as a collection of type names.
      Parameters:
      name - the attribute name
      annotationMirror - the annotation
      elementUtils - the current elements instance