Class Annotated

java.lang.Object
org.openrewrite.java.trait.Annotated
All Implemented Interfaces:
org.openrewrite.trait.Trait<org.openrewrite.java.tree.J.Annotation>

public class Annotated extends Object implements org.openrewrite.trait.Trait<org.openrewrite.java.tree.J.Annotation>
  • Constructor Details

    • Annotated

      public Annotated()
  • Method Details

    • getAttributeValue

      @Incubating(since="8.87.0") public Optional<AttributeValue> getAttributeValue(String attribute)
      Parameters:
      attribute - The name of the annotation attribute.
      Returns:
      The attribute's value, or empty when the attribute is not explicitly present in the source. Defaults declared on the annotation type are not resolved.
    • getDefaultAttributeValue

      @Incubating(since="8.87.0") public Optional<AttributeValue> getDefaultAttributeValue(@Nullable String defaultAlias)
      Parameters:
      defaultAlias - The name of the annotation attribute that is aliased to "value", if any.
      Returns:
      The attribute value in any syntactic shape.
    • getDefaultAttribute

      public Optional<Literal> getDefaultAttribute(@Nullable String defaultAlias)
      Parameters:
      defaultAlias - The name of the annotation attribute that is aliased to "value", if any.
      Returns:
      The attribute value.
    • getAttribute

      public Optional<Literal> getAttribute(String attribute)