Class CodegenUtil

java.lang.Object
io.helidon.codegen.CodegenUtil

public final class CodegenUtil extends Object
Tools for generating code.
  • Method Details

    • capitalize

      public static String capitalize(String name)
      Capitalize the first letter of the provided string.
      Parameters:
      name - string to capitalize
      Returns:
      name with the first character as capital letter
    • toConstantName

      public static String toConstantName(String elementName)
      Create a constant field for a name of an element.

      For example for maxInitialLineLength we would get MAX_INITIAL_LINE_LENGTH.

      Parameters:
      elementName - name of the element
      Returns:
      name of a constant
    • copyright

      public static String copyright(TypeName generator, TypeName trigger, TypeName generatedType)
      Provides copyright header to be added before package declaration.
      Parameters:
      generator - type of the generator (annotation processor)
      trigger - type of the class that caused this type to be generated
      generatedType - type that is going to be generated
      Returns:
      copyright string (can be multiline)
    • generatedAnnotation

      public static Annotation generatedAnnotation(TypeName generator, TypeName trigger, TypeName generatedType, String versionId, String comments)
      Create a generated annotation.
      Parameters:
      generator - type of the generator (annotation processor)
      trigger - type of the class that caused this type to be generated
      generatedType - type that is going to be generated
      versionId - version of the generator
      comments - additional comments, never use null (use empty string so they do not appear in annotation)
      Returns:
      a new annotation to add to the generated type