Package io.micronaut.sourcegen.model
Interface TypeDef
- All Known Subinterfaces:
ClassTypeDef,TypeDef.Annotated
- All Known Implementing Classes:
ClassTypeDef.AnnotatedClassTypeDef,ClassTypeDef.ClassDefType,ClassTypeDef.ClassElementType,ClassTypeDef.ClassName,ClassTypeDef.JavaClass,ClassTypeDef.Parameterized,TypeDef.AnnotatedTypeDef,TypeDef.Array,TypeDef.Primitive,TypeDef.TypeVariable,TypeDef.Wildcard
public sealed interface TypeDef
permits ClassTypeDef, TypeDef.Annotated, TypeDef.Array, TypeDef.Primitive, TypeDef.TypeVariable, TypeDef.Wildcard
The type definition.
Not-null by default.
- Since:
- 1.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA combined type interface for representing a Type with annotations.static final recordA combined type for representing a TypeDef with annotations.static final recordThe type for representing an array.static final recordThe primitive type name.static final recordThe type variable ref.static final recordThe wildcard type definition. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault TypeDef.Annotatedannotated(AnnotationDef... annotations) Define a type with annotations.default TypeDef.Annotatedannotated(List<AnnotationDef> annotations) Define a type with annotations.static TypeDef.Arraystatic TypeDef.Arraydefault ExpressionDefinstantiateArray(int length) Instantiate an array of this class.default ExpressionDefinstantiateArray(ExpressionDef... expressions) Instantiate an array of this class.default ExpressionDefinstantiateArray(List<ExpressionDef> expressions) Instantiate an array of this class.default booleanisArray()default booleandefault booleandefault TypeDefstatic TypeDefof(io.micronaut.inject.ast.ClassElement classElement) Creates a new type.static TypeDefCreates a new type.static ClassTypeDefparameterized(ClassTypeDef type, TypeDef... genericParameters) Creates a new type with generic parameters.static ClassTypeDefparameterized(ClassTypeDef type, Class<?>... genericParameters) Creates a new type with generic parameters.static ClassTypeDefparameterized(ClassTypeDef type, List<TypeDef> genericParameters) Creates a new type with generic parameters.static ClassTypeDefparameterized(Class<?> type, TypeDef... genericParameters) Creates a new type with generic parameters.static ClassTypeDefparameterized(Class<?> type, Class<?>... genericParameters) Creates a new type with generic parameters.static TypeDef.PrimitiveCreates new primitive type.static TypeDef.PrimitiveCreates new primitive type.static TypeDef.Wildcardwildcard()static TypeDef.WildcardwildcardSubtypeOf(TypeDef upperBound) static TypeDef.WildcardwildcardSupertypeOf(TypeDef lowerBound)
-
Field Details
-
VOID
-
OBJECT
-
STRING
-
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
-
annotated
Define a type with annotations.- Parameters:
annotations- the annotation definitions to be added- Returns:
- The AnnotatedTypeDef
- Since:
- 1.4
-
annotated
Define a type with annotations.- Parameters:
annotations- The list of the AnnotationDef- Returns:
- The AnnotatedTypeDef
- Since:
- 1.4
-
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
-
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
-
isPrimitive
default boolean isPrimitive()- Returns:
- Is primitive type
-
isArray
default boolean isArray()- Returns:
- Is Array type
-
makeNullable
- Returns:
- A new nullable type
-