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), can only be a class or a GenericType
      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

      @Deprecated(since="4.2.0", forRemoval=true) public BUILDER addTypeParameter(String typeParameter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      the TypeNameBlueprint.typeArguments() will contain all required information
      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:
    • lowerBounds

      public BUILDER lowerBounds(List<? extends TypeName> lowerBounds)
      Generic types that provide keyword extends will have a lower bound defined. Each lower bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      lowerBounds - list of lower bounds of this type
      Returns:
      updated builder instance
      See Also:
    • addLowerBounds

      public BUILDER addLowerBounds(List<? extends TypeName> lowerBounds)
      Generic types that provide keyword extends will have a lower bound defined. Each lower bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      lowerBounds - list of lower bounds of this type
      Returns:
      updated builder instance
      See Also:
    • addLowerBound

      public BUILDER addLowerBound(TypeName lowerBound)
      Generic types that provide keyword extends will have a lower bound defined. Each lower bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      lowerBound - list of lower bounds of this type
      Returns:
      updated builder instance
      See Also:
    • addLowerBound

      public BUILDER addLowerBound(Consumer<TypeName.Builder> consumer)
      Generic types that provide keyword extends will have a lower bound defined. Each lower bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      consumer - list of lower bounds of this type
      Returns:
      updated builder instance
      See Also:
    • upperBounds

      public BUILDER upperBounds(List<? extends TypeName> upperBounds)
      Generic types that provide keyword super will have an upper bound defined. Upper bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      upperBounds - list of upper bounds of this type
      Returns:
      updated builder instance
      See Also:
    • addUpperBounds

      public BUILDER addUpperBounds(List<? extends TypeName> upperBounds)
      Generic types that provide keyword super will have an upper bound defined. Upper bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      upperBounds - list of upper bounds of this type
      Returns:
      updated builder instance
      See Also:
    • addUpperBound

      public BUILDER addUpperBound(TypeName upperBound)
      Generic types that provide keyword super will have an upper bound defined. Upper bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      upperBound - list of upper bounds of this type
      Returns:
      updated builder instance
      See Also:
    • addUpperBound

      public BUILDER addUpperBound(Consumer<TypeName.Builder> consumer)
      Generic types that provide keyword super will have an upper bound defined. Upper bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Parameters:
      consumer - list of upper bounds of this type
      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

      @Deprecated(since="4.2.0", forRemoval=true) public List<String> typeParameters()
      Deprecated, for removal: This API element is subject to removal in a future version.
      the TypeNameBlueprint.typeArguments() will contain all required information
      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
    • lowerBounds

      public List<TypeName> lowerBounds()
      Generic types that provide keyword extends will have a lower bound defined. Each lower bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Returns:
      the lower bounds
      See Also:
    • upperBounds

      public List<TypeName> upperBounds()
      Generic types that provide keyword super will have an upper bound defined. Upper bound may be a real type, or another generic type.

      This list may only have value if this is a generic type.

      Returns:
      the upper bounds
      See Also:
    • preBuildPrototype

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

      protected void validatePrototype()
      Validates required properties.