Package io.micronaut.sourcegen.model
Interface ClassTypeDef
- All Superinterfaces:
TypeDef
- All Known Implementing Classes:
ClassTypeDef.ClassDefType
,ClassTypeDef.ClassElementType
,ClassTypeDef.ClassName
,ClassTypeDef.JavaClass
,ClassTypeDef.Parameterized
public sealed interface ClassTypeDef
extends TypeDef
permits ClassTypeDef.JavaClass, ClassTypeDef.ClassName, ClassTypeDef.ClassElementType, ClassTypeDef.ClassDefType, ClassTypeDef.Parameterized
The class type definition.
Not-null by default.
- Since:
- 1.0
- Author:
- Denis Stepanov
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final record
The class def element type.static final record
The class element type.static final record
The class name type.static final record
The class type.static final record
The parameterized type definition.Nested classes/interfaces inherited from interface io.micronaut.sourcegen.model.TypeDef
TypeDef.Array, TypeDef.Primitive, TypeDef.TypeVariable, TypeDef.Wildcard
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault StatementDef
doThrow
(ExpressionDef... parameters) Throw an exception.default StatementDef
doThrow
(List<ExpressionDef> parameters) Throw an exception.getName()
default String
default String
default ExpressionDef
Instantiate this class.default ExpressionDef
instantiate
(ExpressionDef... values) Instantiate this class.default ExpressionDef
instantiate
(List<ExpressionDef> parameters) Instantiate this class.default ExpressionDef.CallStaticMethod
invokeStatic
(String name, TypeDef returningType, ExpressionDef... parameters) Invoke static method.default ExpressionDef.CallStaticMethod
invokeStatic
(String name, TypeDef returningType, List<ExpressionDef> parameters) Invoke static method.default boolean
isEnum()
static ClassTypeDef
of
(io.micronaut.inject.ast.ClassElement classElement) Create a new type definition.static ClassTypeDef
Create a new type definition.static ClassTypeDef
Create a new type definition.static ClassTypeDef
Create a new type definition.Methods inherited from interface io.micronaut.sourcegen.model.TypeDef
instantiateArray, instantiateArray, instantiateArray, isNullable
-
Field Details
-
OBJECT
-
-
Method Details
-
getName
String getName()- Returns:
- The type name
-
getSimpleName
- Returns:
- The simple name
-
getPackageName
- Returns:
- The package name
-
makeNullable
ClassTypeDef makeNullable()- Specified by:
makeNullable
in interfaceTypeDef
- Returns:
- A new nullable type
-
isEnum
default boolean isEnum()- Returns:
- True if the class is an enum
- Since:
- 1.2
-
instantiate
Instantiate this class.- Returns:
- The instantiate expression
-
doThrow
Throw an exception.- Parameters:
parameters
- The exception constructor parameters- Returns:
- The instantiate expression
- Since:
- 1.2
-
doThrow
Throw an exception.- Parameters:
parameters
- The exception constructor parameters- Returns:
- The instantiate expression
- Since:
- 1.2
-
instantiate
Instantiate this class.- Parameters:
parameters
- The constructor parameters- Returns:
- The instantiate expression
-
instantiate
Instantiate this class.- Parameters:
values
- The constructor values- Returns:
- The instantiate expression
- Since:
- 1.2
-
invokeStatic
default ExpressionDef.CallStaticMethod invokeStatic(String name, TypeDef returningType, ExpressionDef... parameters) Invoke static method.- Parameters:
name
- The method nameparameters
- The parametersreturningType
- The return type- Returns:
- the invoke static method expression
- Since:
- 1.2
-
invokeStatic
default ExpressionDef.CallStaticMethod invokeStatic(String name, TypeDef returningType, List<ExpressionDef> parameters) Invoke static method.- Parameters:
name
- The method nameparameters
- The parametersreturningType
- The return type- Returns:
- the invoke static method expression
- Since:
- 1.2
-
of
Create a new type definition.- Parameters:
type
- The class- Returns:
- type definition
-
of
Create a new type definition.- Parameters:
className
- The class name- Returns:
- type definition
-
of
Create a new type definition.- Parameters:
classElement
- The class element- Returns:
- type definition
-
of
Create a new type definition.- Parameters:
classDef
- The class definition- Returns:
- type definition
-