Class TypeName.BuilderBase<BUILDER extends TypeName.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TypeName>

java.lang.Object
io.helidon.common.types.TypeName.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
TypeName.Builder
Enclosing interface:
TypeName

public abstract static class TypeName.BuilderBase<BUILDER extends TypeName.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TypeName> extends Object implements Prototype.Builder<BUILDER,PROTOTYPE>
Fluent API builder base for TypeName.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(TypeName prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(TypeName.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • type

      public BUILDER type(Type type)
      Update builder from the provided type.
      Parameters:
      type - type to get information (package name, class name, primitive, array)
      Returns:
      updated builder instance
    • packageName

      public BUILDER packageName(String packageName)
      Functions the same as Class.getPackageName().
      Parameters:
      packageName - the package name, never null
      Returns:
      updated builder instance
      See Also:
    • className

      public BUILDER className(String className)
      Functions the same as Class.getSimpleName().
      Parameters:
      className - the simple class name
      Returns:
      updated builder instance
      See Also:
    • enclosingNames

      public BUILDER enclosingNames(List<? extends String> enclosingNames)
      Simple names of enclosing classes (if any exist). For example for type io.helidon.example.Type$NestOne$NestTwo, this would return a list of Type, NestOne.
      Parameters:
      enclosingNames - enclosing classes simple names
      Returns:
      updated builder instance
      See Also:
    • addEnclosingNames

      public BUILDER addEnclosingNames(List<? extends String> enclosingNames)
      Simple names of enclosing classes (if any exist). For example for type io.helidon.example.Type$NestOne$NestTwo, this would return a list of Type, NestOne.
      Parameters:
      enclosingNames - enclosing classes simple names
      Returns:
      updated builder instance
      See Also:
    • addEnclosingName

      public BUILDER addEnclosingName(String enclosingName)
      Simple names of enclosing classes (if any exist). For example for type io.helidon.example.Type$NestOne$NestTwo, this would return a list of Type, NestOne.
      Parameters:
      enclosingName - enclosing classes simple names
      Returns:
      updated builder instance
      See Also:
    • primitive

      public BUILDER primitive(boolean primitive)
      Functions the same as Class.isPrimitive().
      Parameters:
      primitive - true if this type represents a primitive type
      Returns:
      updated builder instance
      See Also:
    • array

      public BUILDER array(boolean array)
      Functions the same as Class.isArray().
      Parameters:
      array - true if this type represents a primitive array []
      Returns:
      updated builder instance
      See Also:
    • generic

      public BUILDER generic(boolean generic)
      Indicates whether this type is using generics.
      Parameters:
      generic - used to represent a generic (e.g., "Optional<CB>")
      Returns:
      updated builder instance
      See Also:
    • wildcard

      public BUILDER wildcard(boolean wildcard)
      Indicates whether this type is using wildcard generics.
      Parameters:
      wildcard - used to represent a wildcard (e.g., "? extends SomeType")
      Returns:
      updated builder instance
      See Also:
    • typeArguments

      public BUILDER typeArguments(List<? extends TypeName> typeArguments)
      Returns the list of generic type arguments, or an empty list if no generics are in use.
      Parameters:
      typeArguments - the type arguments of this type, if this type supports generics/parameterized type
      Returns:
      updated builder instance
      See Also:
    • addTypeArguments

      public BUILDER addTypeArguments(List<? extends TypeName> typeArguments)
      Returns the list of generic type arguments, or an empty list if no generics are in use.
      Parameters:
      typeArguments - the type arguments of this type, if this type supports generics/parameterized type
      Returns:
      updated builder instance
      See Also:
    • addTypeArgument

      public BUILDER addTypeArgument(TypeName typeArgument)
      Returns the list of generic type arguments, or an empty list if no generics are in use.
      Parameters:
      typeArgument - the type arguments of this type, if this type supports generics/parameterized type
      Returns:
      updated builder instance
      See Also:
    • addTypeArgument

      public BUILDER addTypeArgument(Consumer<TypeName.Builder> consumer)
      Returns the list of generic type arguments, or an empty list if no generics are in use.
      Parameters:
      consumer - the type arguments of this type, if this type supports generics/parameterized type
      Returns:
      updated builder instance
      See Also:
    • typeParameters

      public BUILDER typeParameters(List<? extends String> typeParameters)
      Type parameters associated with the type arguments. The type argument list may be empty, even if this list is not, for example in declaration of the top level type (as arguments are a function of usage of the type). if typeArguments() exist, this list MUST exist and have the same size and order (it maps the name to the type).
      Parameters:
      typeParameters - type parameter names as declared on this type, or names that represent the typeArguments()
      Returns:
      updated builder instance
      See Also:
    • addTypeParameters

      public BUILDER addTypeParameters(List<? extends String> typeParameters)
      Type parameters associated with the type arguments. The type argument list may be empty, even if this list is not, for example in declaration of the top level type (as arguments are a function of usage of the type). if typeArguments() exist, this list MUST exist and have the same size and order (it maps the name to the type).
      Parameters:
      typeParameters - type parameter names as declared on this type, or names that represent the typeArguments()
      Returns:
      updated builder instance
      See Also:
    • addTypeParameter

      public BUILDER addTypeParameter(String typeParameter)
      Type parameters associated with the type arguments. The type argument list may be empty, even if this list is not, for example in declaration of the top level type (as arguments are a function of usage of the type). if typeArguments() exist, this list MUST exist and have the same size and order (it maps the name to the type).
      Parameters:
      typeParameter - type parameter names as declared on this type, or names that represent the typeArguments()
      Returns:
      updated builder instance
      See Also:
    • packageName

      public String packageName()
      Functions the same as Class.getPackageName().
      Returns:
      the package name
    • className

      public Optional<String> className()
      Functions the same as Class.getSimpleName().
      Returns:
      the class name
    • enclosingNames

      public List<String> enclosingNames()
      Simple names of enclosing classes (if any exist). For example for type io.helidon.example.Type$NestOne$NestTwo, this would return a list of Type, NestOne.
      Returns:
      the enclosing names
    • primitive

      public boolean primitive()
      Functions the same as Class.isPrimitive().
      Returns:
      the primitive
    • array

      public boolean array()
      Functions the same as Class.isArray().
      Returns:
      the array
    • generic

      public boolean generic()
      Indicates whether this type is using generics.
      Returns:
      the generic
    • wildcard

      public boolean wildcard()
      Indicates whether this type is using wildcard generics.
      Returns:
      the wildcard
    • typeArguments

      public List<TypeName> typeArguments()
      Returns the list of generic type arguments, or an empty list if no generics are in use.
      Returns:
      the type arguments
      See Also:
    • typeParameters

      public List<String> typeParameters()
      Type parameters associated with the type arguments. The type argument list may be empty, even if this list is not, for example in declaration of the top level type (as arguments are a function of usage of the type). if typeArguments() exist, this list MUST exist and have the same size and order (it maps the name to the type).
      Returns:
      the type parameters
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.