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
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe class def element type.static final recordThe class element type.static final recordThe class name type.static final recordThe class type.static final recordThe parameterized type definition.Nested classes/interfaces inherited from interface io.micronaut.sourcegen.model.TypeDef
TypeDef.Array, TypeDef.Primitive, TypeDef.TypeVariable, TypeDef.Wildcard -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault StatementDefdoThrow(ExpressionDef... parameters) Throw an exception.default StatementDefdoThrow(List<ExpressionDef> parameters) Throw an exception.getName()default Stringdefault Stringdefault ExpressionDefInstantiate this class.default ExpressionDefinstantiate(ExpressionDef... values) Instantiate this class.default ExpressionDefinstantiate(List<ExpressionDef> parameters) Instantiate this class.default ExpressionDef.CallStaticMethodinvokeStatic(String name, TypeDef returningType, ExpressionDef... parameters) Invoke static method.default ExpressionDef.CallStaticMethodinvokeStatic(String name, TypeDef returningType, List<ExpressionDef> parameters) Invoke static method.default booleanisEnum()static ClassTypeDefof(io.micronaut.inject.ast.ClassElement classElement) Create a new type definition.static ClassTypeDefCreate a new type definition.static ClassTypeDefCreate a new type definition.static ClassTypeDefCreate 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:
makeNullablein 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
-