Class TypeArgument

java.lang.Object
io.helidon.codegen.classmodel.TypeArgument
All Implemented Interfaces:
Prototype.Api, TypeName, Comparable<TypeName>

public final class TypeArgument extends Object implements TypeName
Generic type argument model.
  • Method Details

    • create

      public static TypeArgument create(String token)
      Creates new TypeArgument instance based on the provided token.
      Parameters:
      token - argument token
      Returns:
      new argument instance
    • builder

      public static TypeArgument.Builder builder()
      Return new TypeArgument.Builder instance.
      Returns:
      new builder instance
    • boxed

      public TypeName boxed()
      Description copied from interface: TypeName
      Return the boxed equivalent of this type. If this is not a primitive type, returns this instance.
      Specified by:
      boxed in interface TypeName
      Returns:
      boxed type for this type, or this type if not primitive
    • genericTypeName

      public TypeName genericTypeName()
      Description copied from interface: TypeName
      The base generic type name, stripped of any TypeNameBlueprint.typeArguments(). This is equivalent to the type name represented by TypeNameBlueprint.name().
      Specified by:
      genericTypeName in interface TypeName
      Returns:
      based generic type name
    • token

      public String token()
      Type argument token.
      Returns:
      token value
    • packageName

      public String packageName()
    • className

      public String className()
    • enclosingNames

      public List<String> enclosingNames()
    • primitive

      public boolean primitive()
    • array

      public boolean array()
    • generic

      public boolean generic()
    • wildcard

      public boolean wildcard()
    • typeArguments

      public List<TypeName> typeArguments()
    • typeParameters

      public List<String> typeParameters()
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(TypeName o)
      Specified by:
      compareTo in interface Comparable<TypeName>
    • classNameWithEnclosingNames

      default String classNameWithEnclosingNames()
      Class name with enclosing types, separated by .. If we have an inner class Builder of class Type, this method would return Type.Builder.
      Returns:
      class name with enclosing types
    • isList

      default boolean isList()
      Indicates whether this type is a java.util.List.
      Returns:
      if this is a list
    • isSet

      default boolean isSet()
      Indicates whether this type is a java.util.Set.
      Returns:
      if this is a set
    • isMap

      default boolean isMap()
      Indicates whether this type is a java.util.Map.
      Returns:
      if this is a map
    • isOptional

      default boolean isOptional()
      Indicates whether this type is a java.util.Optional.
      Returns:
      if this is an optional
    • isSupplier

      default boolean isSupplier()
      Indicates whether this type is a Supplier.
      Returns:
      if this is a supplier
    • classNameWithTypes

      default String classNameWithTypes()
      Simple class name with generic declaration (if part of this name).
      Returns:
      class name with generics, such as Consumer<java.lang.String>, or Consumer<T>
    • name

      default String name()
      The base name that includes the package name concatenated with the class name. Similar to Type.getTypeName(). Name contains possible enclosing types, separated by $.
      Returns:
      the base type name given the set package and class name, but not including the generics/parameterized types
    • declaredName

      default String declaredName()
      Typically used as part of code-gen, when ".class" is tacked onto the suffix of what this returns.
      Returns:
      same as getName() unless the type is an array, and then will add "[]" to the return
    • fqName

      default String fqName()
      The fully qualified type name.
      Returns:
      the fully qualified name
    • resolvedName

      default String resolvedName()
      The fully resolved type. This will include the generic portion of the declaration, as well as any array declaration, etc.
      Returns:
      the fully qualified name which includes the use of generics/parameterized types, arrays, etc.