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

java.lang.Object
io.helidon.codegen.classmodel.ClassBase.Builder<B,T>
Type Parameters:
B - builder type
T - built object type
All Implemented Interfaces:
Builder<B,T>, Supplier<T>
Direct Known Subclasses:
ClassModel.Builder, InnerClass.Builder
Enclosing class:
ClassBase

public abstract static class ClassBase.Builder<B extends ClassBase.Builder<B,T>,T extends ClassBase> extends Object
Fluent API builder for ClassBase.
  • Method Details

    • javadoc

      public B javadoc(Javadoc javadoc)
    • addJavadocTag

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

      public B accessModifier(AccessModifier accessModifier)
    • isFinal

      public B isFinal(boolean isFinal)
      Whether this type is final.
      Parameters:
      isFinal - type is abstract
      Returns:
      updated builder instance
    • isAbstract

      public B isAbstract(boolean isAbstract)
      Whether this type is abstract.
      Parameters:
      isAbstract - type is abstract
      Returns:
      updated builder instance
    • superType

      public B superType(Class<?> superType)
      Set new super type of this type.
      Parameters:
      superType - super type of this type
      Returns:
      updated builder instance
    • superType

      public B superType(String superType)
      Set new fully qualified super type name of this type.
      Parameters:
      superType - super type of this type
      Returns:
      updated builder instance
    • superType

      public B superType(TypeName superType)
      Set new super type of this type.
      Parameters:
      superType - super type of this type
      Returns:
      updated builder instance
    • addField

      public B addField(Consumer<Field.Builder> consumer)
      Add new field to the type.
      Parameters:
      consumer - field builder consumer
      Returns:
      updated builder instance
    • addField

      public B addField(Field.Builder builder)
      Add new field to the type.
      Parameters:
      builder - field builder
      Returns:
      updated builder instance
    • addField

      public B addField(Field field)
      Add new field to the type.
      Parameters:
      field - new field
      Returns:
      updated builder instance
    • addMethod

      public B addMethod(Consumer<Method.Builder> consumer)
      Add new method to the type.
      Parameters:
      consumer - method builder consumer
      Returns:
      updated builder instance
    • addMethod

      public B addMethod(Method.Builder builder)
      Add new method to the type.
      Parameters:
      builder - method builder
      Returns:
      updated builder instance
    • addMethod

      public B addMethod(Method method)
      Add new method to the type.
      Parameters:
      method - new method
      Returns:
      updated builder instance
    • addInterface

      public B addInterface(Class<?> interfaceType)
      Add interface this type should implement.
      Parameters:
      interfaceType - interface type to implement
      Returns:
      updated builder instance
    • addInterface

      public B addInterface(String interfaceName)
      Add interface this type should implement.
      Parameters:
      interfaceName - fully qualified interface name to implement
      Returns:
      updated builder instance
    • addInterface

      public B addInterface(TypeName interfaceType)
      Add interface this type should implement.
      Parameters:
      interfaceType - interface to implement
      Returns:
      updated builder instance
    • addInnerClass

      public B addInnerClass(Consumer<InnerClass.Builder> consumer)
      Add new inner type to this type.
      Parameters:
      consumer - inner class builder consumer
      Returns:
      updated builder instance
    • addInnerClass

      public B addInnerClass(Supplier<InnerClass> supplier)
      Add new inner type to this type.
      Parameters:
      supplier - inner class builder supplier
      Returns:
      updated builder instance
    • addInnerClass

      public B addInnerClass(InnerClass innerClass)
      Add new inner type to this type.
      Parameters:
      innerClass - inner class instance
      Returns:
      updated builder instance
    • addConstructor

      public B addConstructor(Constructor.Builder constructor)
      Add new constructor to this class.
      Parameters:
      constructor - constructor builder
      Returns:
      updated builder instance
    • addConstructor

      public B addConstructor(Consumer<Constructor.Builder> consumer)
      Add new constructor to this class.
      Parameters:
      consumer - constructor builder consumer
      Returns:
      updated builder instance
    • addGenericArgument

      public B addGenericArgument(TypeArgument typeArgument)
      Add generic argument type.
      Parameters:
      typeArgument - generic argument type
      Returns:
      updated builder instance
    • addGenericArgument

      public B addGenericArgument(Consumer<TypeArgument.Builder> consumer)
      Add generic argument type.
      Parameters:
      consumer - generic argument type builder consumer
      Returns:
      updated builder instance
    • addImport

      public B addImport(Class<?> typeImport)
      Add specific class to be imported.
      Parameters:
      typeImport - type to be included among imports
      Returns:
      updated builder instance
    • addImport

      public B addImport(String importName)
      Add specific fully qualified type name to be imported.
      Parameters:
      importName - type to be included among imports
      Returns:
      updated builder instance
    • addImport

      public B addImport(TypeName typeName)
      Add specific fully qualified type name to be imported.
      Parameters:
      typeName - type to be included among imports
      Returns:
      updated builder instance
    • addStaticImport

      public B addStaticImport(String staticImport)
      Add specific static import.
      Parameters:
      staticImport - fully qualified static import name
      Returns:
      updated builder instance
    • classType

      public B classType(ClassType classType)
      Type of the Java type we are creating. For example: class, interface etc.
      Parameters:
      classType - Java type
      Returns:
      updated builder instance
    • classType

      public B classType(ElementKind kind)
      Type of the Java type we are creating. For example: class, interface etc.
      Parameters:
      kind - the element kind, must be a supported top level type
      Returns:
      updated builder instance
      Throws:
      IllegalArgumentException - in case the kind is not supported
    • sortFields

      public B sortFields(boolean sort)
      Whether to sort non-static fields by type and name (defaults to true). If set to false, fields are ordered by insertion sequence.
      Parameters:
      sort - whether to sort fields
      Returns:
      updated builder instance
    • sortStaticFields

      public B sortStaticFields(boolean sort)
      Whether to sort static fields by type and name (defaults to true). If set to false, fields are ordered by insertion sequence.
      Parameters:
      sort - whether to sort fields
      Returns:
      updated builder instance
    • 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