Class Field.Builder

java.lang.Object
io.helidon.codegen.classmodel.Field.Builder
All Implemented Interfaces:
ContentBuilder<Field.Builder>, Builder<Field.Builder,Field>, Supplier<Field>
Enclosing class:
Field

public static final class Field.Builder extends Object implements ContentBuilder<Field.Builder>
Fluent API builder for Field.
  • Method Details

    • build

      public Field build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<Field.Builder,Field>
      Returns:
      instance of the built type
    • defaultValue

      public Field.Builder defaultValue(String defaultValue)
      Set default value this field should be initialized with, wrapping the value in double quotes if the field type is String.
      Parameters:
      defaultValue - default value
      Returns:
      updated builder instance
    • defaultValueContent

      public Field.Builder defaultValueContent(String defaultValue)
      Configure a default value for this field as a string that will be copied verbatim to the generated sources.
      Parameters:
      defaultValue - default value
      Returns:
      updated builder instance
    • content

      public Field.Builder content(List<String> content)
      Description copied from interface: ContentBuilder
      Set new content. This method replaces previously created content in this builder.
      Specified by:
      content in interface ContentBuilder<Field.Builder>
      Parameters:
      content - content to be set
      Returns:
      updated builder instance
    • addContent

      public Field.Builder addContent(String line)
      Description copied from interface: ContentBuilder
      Add text line to the content. New line character is not added after this line, so all newly added text will be appended to the same line.
      Specified by:
      addContent in interface ContentBuilder<Field.Builder>
      Parameters:
      line - line to add
      Returns:
      updated builder instance
    • addContent

      public Field.Builder addContent(TypeName typeName)
      Description copied from interface: ContentBuilder
      Add type name to content, correctly handling imports. In case the type should not contain any type parameters, use TypeName.genericTypeName().
      Specified by:
      addContent in interface ContentBuilder<Field.Builder>
      Parameters:
      typeName - type name to add
      Returns:
      updated component builder
    • padContent

      public Field.Builder padContent()
      Description copied from interface: ContentBuilder
      Adds single padding. This extra padding is added only once. If more permanent padding increment is needed use {ContentBuilder.increaseContentPadding()}.
      Specified by:
      padContent in interface ContentBuilder<Field.Builder>
      Returns:
      updated builder instance
    • padContent

      public Field.Builder padContent(int repetition)
      Description copied from interface: ContentBuilder
      Adds padding with number of repetitions. This extra padding is added only once. If more permanent padding increment is needed use {ContentBuilder.increaseContentPadding()}.
      Specified by:
      padContent in interface ContentBuilder<Field.Builder>
      Parameters:
      repetition - number of padding repetitions
      Returns:
      updated builder instance
    • increaseContentPadding

      public Field.Builder increaseContentPadding()
      Description copied from interface: ContentBuilder
      Method for manual padding increment. This method will affect padding of the later added content.
      Specified by:
      increaseContentPadding in interface ContentBuilder<Field.Builder>
      Returns:
      updated builder instance
    • decreaseContentPadding

      public Field.Builder decreaseContentPadding()
      Description copied from interface: ContentBuilder
      Method for manual padding decrement. This method will affect padding of the later added content.
      Specified by:
      decreaseContentPadding in interface ContentBuilder<Field.Builder>
      Returns:
      updated builder instance
    • clearContent

      public Field.Builder clearContent()
      Description copied from interface: ContentBuilder
      Clears created content.
      Specified by:
      clearContent in interface ContentBuilder<Field.Builder>
      Returns:
      updated builder instance
    • addTypeToContent

      public Field.Builder addTypeToContent(String typeName)
      Description copied from interface: ContentBuilder
      Obtained fully qualified type name is enclosed between ClassModel.TYPE_TOKEN tokens. Class names in such a format are later recognized as class names for import handling.
      Specified by:
      addTypeToContent in interface ContentBuilder<Field.Builder>
      Parameters:
      typeName - fully qualified class name to import
      Returns:
      updated builder instance
    • isFinal

      public Field.Builder isFinal(boolean isFinal)
      Whether this field is final.
      Parameters:
      isFinal - final field
      Returns:
      updated builder instance
    • isVolatile

      public Field.Builder isVolatile(boolean isVolatile)
      Whether this field is volatile.
      Parameters:
      isVolatile - volatile field
      Returns:
      updated builder instance
    • isStatic

      public Field.Builder isStatic(boolean isStatic)
      Whether this field is static.
      Parameters:
      isStatic - static field
      Returns:
      updated builder instance
    • type

      public Field.Builder type(TypeName type)
    • type

      public Field.Builder type(String type)
    • type

      public Field.Builder type(Class<?> type)
    • accessModifier

      public Field.Builder accessModifier(AccessModifier accessModifier)
    • javadoc

      public Field.Builder javadoc(Javadoc javadoc)
    • description

      public Field.Builder description(String description)
    • description

      public Field.Builder description(List<String> description)
    • addDescriptionLine

      public Field.Builder addDescriptionLine(String line)
    • addAnnotation

      public Field.Builder addAnnotation(Annotation annotation)
      Add new annotation to the component.
      Parameters:
      annotation - annotation instance
      Returns:
      updated builder instance
    • addAnnotation

      public Field.Builder addAnnotation(Consumer<Annotation.Builder> consumer)
      Add new annotation to the component.
      Parameters:
      consumer - annotation builder consumer
      Returns:
      updated builder instance
    • addAnnotation

      public Field.Builder addAnnotation(Annotation.Builder builder)
      Add new annotation to the component.
      Parameters:
      builder - annotation builder
      Returns:
      updated builder instance
    • addAnnotation

      public Field.Builder addAnnotation(Annotation annotation)
      Add new annotation to the component.
      Parameters:
      annotation - annotation instance
      Returns:
      updated builder instance
    • name

      public Field.Builder name(String name)
    • includeImport

      public Field.Builder includeImport(boolean includeImport)
      Whether to include import type information among the imports.
      Parameters:
      includeImport - whether imports should be included
      Returns:
      updated builder instance