java.lang.Object
io.helidon.common.types.DefaultTypeName
- All Implemented Interfaces:
TypeName,Comparable<TypeName>
Default implementation for
TypeName.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanarray()Functions the same asClass.isArray().static DefaultTypeName.Builderbuilder()Creates a builder forTypeName.protected StringCalculates the fully qualified name - this is lazily deferred until referenced infqName().protected StringcalcName()Calculates the name - this is lazily deferred until referenced inname().Functions the same asClass.getSimpleName().intstatic DefaultTypeNameCreates a type name from a class.static DefaultTypeNameCreates a type name from a package name and simple class name.static TypeNamecreateExtendsTypeName(TypeName typeName) Given a typeName X, will return an typeName of "? extends X".static DefaultTypeNamecreateFromGenericDeclaration(String genericAliasTypeName) Creates a type name from a generic alias type name.static DefaultTypeNamecreateFromTypeName(String typeName) Creates a type name from a fully qualified class name.Typically used as part of code-gen, when ".class" is tacked onto the suffix of what this returns.static voidensureIsFQN(TypeName name) Throws an exception if the provided type name is not fully qualified, having a package and class name representation.booleanfqName()The fully qualified type name.booleangeneric()Indicates whether this type is using generics.inthashCode()static booleanReturns true if the provided type name is fully qualified, having a package and class name representation.name()The base name that includes the package name concatenated with the class name.Functions the same asClass.getPackageName().booleanFunctions the same asClass.isPrimitive().Creates a builder initialized with the current values.static DefaultTypeName.BuilderCreates a builder initialized with a value passed.toString()Returns the list of generic type parameters, or an empty list if no generics are in use.booleanwildcard()Indicates whether this type is using wildcard generics.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.helidon.common.types.TypeName
isList, isMap, isOptional, isSet
-
Constructor Details
-
DefaultTypeName
Ctor.- Parameters:
b- the builder- See Also:
-
-
Method Details
-
toString
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<TypeName>
-
create
Creates a type name from a package name and simple class name.- Parameters:
packageName- the package nameclassName- the simple class type name- Returns:
- the TypeName for the provided package and class names
-
create
Creates a type name from a class.- Parameters:
classType- the class type- Returns:
- the TypeName for the provided class type
-
createFromGenericDeclaration
Creates a type name from a generic alias type name.- Parameters:
genericAliasTypeName- the generic alias type name- Returns:
- the TypeName for the provided type name
-
createFromTypeName
Creates a type name from a fully qualified class name.- Parameters:
typeName- the FQN of the class type- Returns:
- the TypeName for the provided type name
-
createExtendsTypeName
Given a typeName X, will return an typeName of "? extends X".- Parameters:
typeName- the typeName- Returns:
- the wildcard extension of the given typeName
-
ensureIsFQN
Throws an exception if the provided type name is not fully qualified, having a package and class name representation.- Parameters:
name- the type name to check- Throws:
IllegalStateException- if the name is invalid
-
isFQN
Returns true if the provided type name is fully qualified, having a package and class name representation.- Parameters:
name- the type name to check- Returns:
- true if the provided name is fully qualified
-
packageName
Description copied from interface:TypeNameFunctions the same asClass.getPackageName().- Specified by:
packageNamein interfaceTypeName- Returns:
- the package name, never null
-
className
Description copied from interface:TypeNameFunctions the same asClass.getSimpleName(). -
primitive
public boolean primitive()Description copied from interface:TypeNameFunctions the same asClass.isPrimitive(). -
array
public boolean array()Description copied from interface:TypeNameFunctions the same asClass.isArray(). -
generic
public boolean generic()Description copied from interface:TypeNameIndicates whether this type is using generics. -
wildcard
public boolean wildcard()Description copied from interface:TypeNameIndicates whether this type is using wildcard generics. -
typeArguments
Description copied from interface:TypeNameReturns the list of generic type parameters, or an empty list if no generics are in use.- Specified by:
typeArgumentsin interfaceTypeName- Returns:
- the type arguments of this type, if this type supports generics/parameterized type.
-
name
Description copied from interface:TypeNameThe base name that includes the package name concatenated with the class name. Similar toType.getTypeName(). -
declaredName
Description copied from interface:TypeNameTypically used as part of code-gen, when ".class" is tacked onto the suffix of what this returns.- Specified by:
declaredNamein interfaceTypeName- Returns:
- same as getName() unless the type is an array, and then will add "[]" to the return.
-
fqName
Description copied from interface:TypeNameThe fully qualified type name. This will include the generic portion of the declaration, as well as any array declaration, etc. -
calcName
Calculates the name - this is lazily deferred until referenced inname().- Returns:
- the name
-
calcFQName
Calculates the fully qualified name - this is lazily deferred until referenced infqName().- Returns:
- the fully qualified name
-
builder
Creates a builder forTypeName.- Returns:
- a fluent builder
-
toBuilder
Creates a builder initialized with a value passed.- Parameters:
val- the value- Returns:
- a fluent builder
-
toBuilder
Creates a builder initialized with the current values.- Returns:
- a fluent builder
-