java.lang.Object
io.helidon.codegen.classmodel.Annotation

public final class Annotation extends Object
Model of the annotation.
  • Method Details

    • builder

      public static Annotation.Builder builder()
      New Annotation.Builder instance.
      Returns:
      new builder instance
    • create

      public static Annotation create(Class<?> type)
      New Annotation instance based on the type.
      Parameters:
      type - class type
      Returns:
      new annotation instance
    • parse

      public static Annotation parse(String annotationDefinition)
      Parse new Annotation object out of the String.

      This method works as expected for the following types:

      • java.lang.String - expecting a quoted value, escapes of inner quotes is possible
      • boolean - if the value is not quoted and is equal either to {code true} or false
      • integer - if the value is not quoted and is a number
      • double - if the value is not quoted, and ends with D (capital letter d)
      • long - if the value is not quoted and ends with L (capital letter l)
      • float - if the value is not quoted and ends with F (capital letter f)
      • char - if the value is in single quotes '
      • arrays - if the value is surrounded by curly braces {} it is an array
      • annotations - if the value starts with at sign (@)
      The following types have special handling and require explicit configuration:
      • byte - unquoted value ending with B, such as 49B
      • short - unquoted value ending with S, such as 49S
      • class - unquoted value, in format class::fq-name, such as class::java.lang.String
      • enum - unquoted value, in format enum::fq-name.NAME, such as enum::java.lang.annotation.ElementType.CONSTRUCTOR
      If the annotation only has a single value and the property name is value, the property name can be omitted (same as when declaring the annotation in Java).

      If the annotation does not need to declare any value, braces can be omitted (same as when declaring the annotation in Java)

      Parameters:
      annotationDefinition - annotation definition
      Returns:
      new annotation instance
    • create

      public static Annotation create(Annotation annotation)
      Create a class model annotation from common types annotation.
      Parameters:
      annotation - annotation to process
      Returns:
      a new class model annotation
    • toTypesAnnotation

      public Annotation toTypesAnnotation()
      Convert class model annotation to Helidon Common Types annotation.
      Returns:
      common types annotation
    • name

      public String name()
      Name of this component.
      Returns:
      component name
    • accessModifier

      public AccessModifier accessModifier()
      Access modifier of this component.
      Returns:
      access modifier
    • description

      public List<String> description()
      Description (javadoc) of this component.
      Returns:
      description lines
    • typeName

      public TypeName typeName()
      Type name of this component.
      Returns:
      type name