Class Executable.Builder<B extends Executable.Builder<B,T>,T extends Executable>

java.lang.Object
io.helidon.codegen.classmodel.Executable.Builder<B,T>
Type Parameters:
B - type of the builder
T - type of the built instance
All Implemented Interfaces:
ContentBuilder<B>, Builder<B,T>, Supplier<T>
Direct Known Subclasses:
Constructor.Builder, Method.Builder
Enclosing class:
Executable

public abstract static class Executable.Builder<B extends Executable.Builder<B,T>,T extends Executable> extends Object implements ContentBuilder<B>
Base builder from executable components (method an constructor).
  • Method Details

    • javadoc

      public B javadoc(Javadoc javadoc)
    • addJavadocTag

      public B addJavadocTag(String tag, String description)
    • accessModifier

      public B accessModifier(AccessModifier accessModifier)
    • content

      public B 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<B extends Executable.Builder<B,T>>
      Parameters:
      content - content to be set
      Returns:
      updated builder instance
    • addContent

      public B 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<B extends Executable.Builder<B,T>>
      Parameters:
      line - line to add
      Returns:
      updated builder instance
    • addContent

      public B 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<B extends Executable.Builder<B,T>>
      Parameters:
      typeName - type name to add
      Returns:
      updated component builder
    • addTypeToContent

      public B 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<B extends Executable.Builder<B,T>>
      Parameters:
      typeName - fully qualified class name to import
      Returns:
      updated builder instance
    • padContent

      public B 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<B extends Executable.Builder<B,T>>
      Returns:
      updated builder instance
    • padContent

      public B 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<B extends Executable.Builder<B,T>>
      Parameters:
      repetition - number of padding repetitions
      Returns:
      updated builder instance
    • increaseContentPadding

      public B 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<B extends Executable.Builder<B,T>>
      Returns:
      updated builder instance
    • decreaseContentPadding

      public B 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<B extends Executable.Builder<B,T>>
      Returns:
      updated builder instance
    • clearContent

      public B clearContent()
      Description copied from interface: ContentBuilder
      Clears created content.
      Specified by:
      clearContent in interface ContentBuilder<B extends Executable.Builder<B,T>>
      Returns:
      updated builder instance
    • addParameter

      public B addParameter(Consumer<Parameter.Builder> consumer)
      Add new method parameter.
      Parameters:
      consumer - method builder consumer
      Returns:
      updated builder instance
    • addParameter

      public B addParameter(Parameter parameter)
      Add new method parameter.
      Parameters:
      parameter - method parameter
      Returns:
      updated builder instance
    • addParameter

      public B addParameter(Supplier<Parameter> supplier)
      Add new method parameter.
      Parameters:
      supplier - method parameter supplier
      Returns:
      updated builder instance
    • addThrows

      public B addThrows(TypeName exception, String description)
      Add a declared throws definition.
      Parameters:
      exception - exception declaration
      description - description to add to javadoc
      Returns:
      updated builder instance
    • addThrows

      public B addThrows(Consumer<Throws.Builder> consumer)
      Add a declared throws definition.
      Parameters:
      consumer - exception declaration builder consumer
      Returns:
      updated builder instance
    • addThrows

      public B addThrows(Supplier<Throws> supplier)
      Add a declared throws definition.
      Parameters:
      supplier - exception declaration supplier
      Returns:
      updated builder instance
    • addThrows

      public B addThrows(Throws exception)
      Add a declared throws definition.
      Parameters:
      exception - exception declaration
      Returns:
      updated builder instance
    • generateJavadoc

      public B generateJavadoc(boolean generateJavadoc)
    • description

      public B description(String description)
    • description

      public B description(List<String> description)
    • addDescriptionLine

      public B addDescriptionLine(String line)
    • addAnnotation

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

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

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

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

      public B name(String name)
    • includeImport

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