Package io.micronaut.sourcegen.model
Interface TypeDef
- All Known Subinterfaces:
ClassTypeDef
- All Known Implementing Classes:
ClassTypeDef.ClassDefType
,ClassTypeDef.ClassElementType
,ClassTypeDef.ClassName
,ClassTypeDef.JavaClass
,ClassTypeDef.Parameterized
,TypeDef.Array
,TypeDef.Primitive
,TypeDef.TypeVariable
,TypeDef.Wildcard
public sealed interface TypeDef
permits ClassTypeDef, TypeDef.Array, TypeDef.Primitive, TypeDef.TypeVariable, TypeDef.Wildcard
The type definition.
Not-null by default.
- Since:
- 1.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final record
The type for representing an array.static final record
The primitive type name.static final record
The type variable ref.static final record
The wildcard type definition. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TypeDef.Array
static TypeDef.Array
default ExpressionDef
instantiateArray
(int length) Instantiate an array of this class.default ExpressionDef
instantiateArray
(ExpressionDef... expressions) Instantiate an array of this class.default ExpressionDef
instantiateArray
(List<ExpressionDef> expressions) Instantiate an array of this class.default boolean
default TypeDef
static TypeDef
of
(io.micronaut.inject.ast.ClassElement classElement) Creates a new type.static TypeDef
Creates a new type.static ClassTypeDef
parameterized
(ClassTypeDef type, TypeDef... genericParameters) Creates a new type with generic parameters.static ClassTypeDef
parameterized
(ClassTypeDef type, List<TypeDef> genericParameters) Creates a new type with generic parameters.static ClassTypeDef
parameterized
(Class<?> type, TypeDef... genericParameters) Creates a new type with generic parameters.static ClassTypeDef
parameterized
(Class<?> type, Class<?>... genericParameters) Creates a new type with generic parameters.static TypeDef
Creates new primitive type.static TypeDef
Creates new primitive type.static TypeDef.Wildcard
wildcard()
static TypeDef.Wildcard
wildcardSubtypeOf
(TypeDef upperBound) static TypeDef.Wildcard
wildcardSupertypeOf
(TypeDef lowerBound)
-
Field Details
-
VOID
-
OBJECT
-
BOOLEAN
-
THIS
A simple type representing a special this-type, in context of a class def, method or field the type will be replaced by the current type.
-
-
Method Details
-
instantiateArray
Instantiate an array of this class.- Parameters:
length
- The length of the array- Returns:
- The instantiate expression
- Since:
- 1.2
-
instantiateArray
Instantiate an array of this class.- Parameters:
expressions
- The items expressions- Returns:
- The instantiate expression
- Since:
- 1.2
-
instantiateArray
Instantiate an array of this class.- Parameters:
expressions
- The items expressions- Returns:
- The instantiate expression
- Since:
- 1.2
-
primitive
Creates new primitive type.- Parameters:
name
- The primitive type name- Returns:
- a new type definition
-
primitive
Creates new primitive type.- Parameters:
type
- The primitive type- Returns:
- a new type definition
-
wildcard
-
wildcardSubtypeOf
-
wildcardSupertypeOf
-
array
-
array
-
of
Creates a new type.- Parameters:
type
- The type- Returns:
- a new type definition
-
parameterized
Creates a new type with generic parameters.- Parameters:
type
- The typegenericParameters
- The parameters- Returns:
- a new type definition
-
parameterized
Creates a new type with generic parameters.- Parameters:
type
- The typegenericParameters
- The parameters- Returns:
- a new type definition
-
parameterized
Creates a new type with generic parameters.- Parameters:
type
- The typegenericParameters
- The parameters- Returns:
- a new type definition
-
parameterized
Creates a new type with generic parameters.- Parameters:
type
- The typegenericParameters
- The parameters- Returns:
- a new type definition
-
of
Creates a new type.- Parameters:
classElement
- The class element- Returns:
- a new type definition
-
isNullable
default boolean isNullable()- Returns:
- Is nullable type
-
makeNullable
- Returns:
- A new nullable type
-