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 similar to Class.getPackageName().
      Parameters:
      packageName - the package name, never null
      Returns:
      updated builder instance
      See Also:
    • className

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

      public BUILDER clearEnclosingNames()
      Clear all enclosingNames.
      Returns:
      updated builder instance
      See Also:
    • enclosingNames

      public BUILDER enclosingNames(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.
      Parameters:
      enclosingNames - enclosing classes simple names
      Returns:
      updated builder instance
      See Also:
    • addEnclosingNames

      public BUILDER addEnclosingNames(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.
      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 - add single enclosing classes simple names
      Returns:
      updated builder instance
      See Also:
    • primitive

      public BUILDER primitive(boolean primitive)
      Functions similar to 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 similar to Class.isArray().
      Parameters:
      array - true if this type represents a primitive array []
      Returns:
      updated builder instance
      See Also:
    • vararg

      public BUILDER vararg(boolean vararg)
      If this is a representation of TypeName.array(), this method can identify that it was declared as a vararg. This may be used for method/constructor parameters (which is the only place this is supported in Java).
      Parameters:
      vararg - whether an array is declared as a vararg
      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:
    • clearTypeArguments

      public BUILDER clearTypeArguments()
      Clear all typeArguments.
      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 - add single 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 - consumer of builder for the type arguments of this type, if this type supports generics/parameterized type
      Returns:
      updated builder instance
      See Also:
    • clearTypeParameters

      public BUILDER clearTypeParameters()
      Clear all typeParameters.
      Returns:
      updated builder instance
      See Also:
    • typeParameters

      public BUILDER typeParameters(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).
      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<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 - add single type parameter names as declared on this type, or names that represent the typeArguments()
      Returns:
      updated builder instance
      See Also:
    • clearLowerBounds

      public BUILDER clearLowerBounds()
      Clear all lowerBounds.
      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 - add single 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 - consumer of builder for list of lower bounds of this type
      Returns:
      updated builder instance
      See Also:
    • clearUpperBounds

      public BUILDER clearUpperBounds()
      Clear all upperBounds.
      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 - add single 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 - consumer of builder for list of upper bounds of this type
      Returns:
      updated builder instance
      See Also:
    • clearComponentType

      public BUILDER clearComponentType()
      Clear existing value of componentType.
      Returns:
      updated builder instance
      See Also:
    • componentType

      public BUILDER componentType(TypeName componentType)
      Component type of array.
      Parameters:
      componentType - component type of array
      Returns:
      updated builder instance
      See Also:
    • componentType

      public BUILDER componentType(Consumer<TypeName.Builder> consumer)
      Component type of array.
      Parameters:
      consumer - consumer of builder of component type of array
      Returns:
      updated builder instance
      See Also:
    • componentType

      public BUILDER componentType(Supplier<? extends TypeName> supplier)
      Component type of array.
      Parameters:
      supplier - supplier of component type of array
      Returns:
      updated builder instance
      See Also:
    • clearAnnotations

      public BUILDER clearAnnotations()
      Clear all annotations.
      Returns:
      updated builder instance
      See Also:
    • annotations

      public BUILDER annotations(List<? extends Annotation> annotations)
      List of declared and known annotations for this element. Note that "known" implies that the annotation is visible, which depends upon the context in which it was build (such as the of the annotation).
      Parameters:
      annotations - the list of annotations declared on this element
      Returns:
      updated builder instance
      See Also:
    • addAnnotations

      public BUILDER addAnnotations(List<? extends Annotation> annotations)
      List of declared and known annotations for this element. Note that "known" implies that the annotation is visible, which depends upon the context in which it was build (such as the of the annotation).
      Parameters:
      annotations - the list of annotations declared on this element
      Returns:
      updated builder instance
      See Also:
    • addAnnotation

      public BUILDER addAnnotation(Annotation annotation)
      List of declared and known annotations for this element. Note that "known" implies that the annotation is visible, which depends upon the context in which it was build (such as the of the annotation).
      Parameters:
      annotation - add single the list of annotations declared on this element
      Returns:
      updated builder instance
      See Also:
    • addAnnotation

      public BUILDER addAnnotation(Consumer<Annotation.Builder> consumer)
      List of declared and known annotations for this element. Note that "known" implies that the annotation is visible, which depends upon the context in which it was build (such as the of the annotation).
      Parameters:
      consumer - consumer of builder for the list of annotations declared on this element
      Returns:
      updated builder instance
      See Also:
    • clearInheritedAnnotations

      public BUILDER clearInheritedAnnotations()
      Clear all inheritedAnnotations.
      Returns:
      updated builder instance
      See Also:
    • inheritedAnnotations

      public BUILDER inheritedAnnotations(List<? extends Annotation> inheritedAnnotations)
      List of all inherited annotations for this element. Inherited annotations are annotations declared on annotations of this element that are also marked as Inherited.

      The returned list does not contain annotations(). If a meta-annotation is present on multiple annotations, it will be returned once for each such declaration.

      This method does not return annotations on super types or interfaces!

      Parameters:
      inheritedAnnotations - list of all meta annotations of this element
      Returns:
      updated builder instance
      See Also:
    • addInheritedAnnotations

      public BUILDER addInheritedAnnotations(List<? extends Annotation> inheritedAnnotations)
      List of all inherited annotations for this element. Inherited annotations are annotations declared on annotations of this element that are also marked as Inherited.

      The returned list does not contain annotations(). If a meta-annotation is present on multiple annotations, it will be returned once for each such declaration.

      This method does not return annotations on super types or interfaces!

      Parameters:
      inheritedAnnotations - list of all meta annotations of this element
      Returns:
      updated builder instance
      See Also:
    • addInheritedAnnotation

      public BUILDER addInheritedAnnotation(Annotation inheritedAnnotation)
      List of all inherited annotations for this element. Inherited annotations are annotations declared on annotations of this element that are also marked as Inherited.

      The returned list does not contain annotations(). If a meta-annotation is present on multiple annotations, it will be returned once for each such declaration.

      This method does not return annotations on super types or interfaces!

      Parameters:
      inheritedAnnotation - add single list of all meta annotations of this element
      Returns:
      updated builder instance
      See Also:
    • addInheritedAnnotation

      public BUILDER addInheritedAnnotation(Consumer<Annotation.Builder> consumer)
      List of all inherited annotations for this element. Inherited annotations are annotations declared on annotations of this element that are also marked as Inherited.

      The returned list does not contain annotations(). If a meta-annotation is present on multiple annotations, it will be returned once for each such declaration.

      This method does not return annotations on super types or interfaces!

      Parameters:
      consumer - consumer of builder for list of all meta annotations of this element
      Returns:
      updated builder instance
      See Also:
    • packageName

      public String packageName()
      Functions similar to Class.getPackageName().
      Returns:
      the package name, never null
    • className

      public Optional<String> className()
      Functions similar to Class.getSimpleName().
      Returns:
      the simple 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:
      enclosing classes simple names
    • primitive

      public boolean primitive()
      Functions similar to Class.isPrimitive().
      Returns:
      true if this type represents a primitive type
    • array

      public boolean array()
      Functions similar to Class.isArray().
      Returns:
      true if this type represents a primitive array []
    • vararg

      public boolean vararg()
      If this is a representation of TypeName.array(), this method can identify that it was declared as a vararg. This may be used for method/constructor parameters (which is the only place this is supported in Java).
      Returns:
      whether an array is declared as a vararg
    • generic

      public boolean generic()
      Indicates whether this type is using generics.
      Returns:
      used to represent a generic (e.g., "Optional<CB>")
    • wildcard

      public boolean wildcard()
      Indicates whether this type is using wildcard generics.
      Returns:
      used to represent a wildcard (e.g., "? extends SomeType")
    • 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 of this type, if this type supports generics/parameterized type
      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:
      type parameter names as declared on this type, or names that represent the typeArguments()
    • 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:
      list of lower bounds of this type
      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:
      list of upper bounds of this type
      See Also:
    • componentType

      public Optional<TypeName> componentType()
      Component type of array.
      Returns:
      component type of array
    • annotations

      public List<Annotation> annotations()
      List of declared and known annotations for this element. Note that "known" implies that the annotation is visible, which depends upon the context in which it was build (such as the of the annotation).
      Returns:
      the list of annotations declared on this element
    • inheritedAnnotations

      public List<Annotation> inheritedAnnotations()
      List of all inherited annotations for this element. Inherited annotations are annotations declared on annotations of this element that are also marked as Inherited.

      The returned list does not contain annotations(). If a meta-annotation is present on multiple annotations, it will be returned once for each such declaration.

      This method does not return annotations on super types or interfaces!

      Returns:
      list of all meta annotations of this element
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

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

      protected void validatePrototype()
      Validates required properties.