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.ClassName, ClassTypeDef.JavaClass, 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
A combined type for representing a ClassTypeDef with annotations.static 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.Annotated, TypeDef.AnnotatedTypeDef, TypeDef.Array, TypeDef.Primitive, TypeDef.TypeVariable, TypeDef.Wildcard
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionannotated
(AnnotationDef... annotations) Define a ClassTypeDef with annotations.annotated
(List<AnnotationDef> annotations) Define a ClassTypeDef with annotations.default String
getName()
default String
default String
default VariableDef.StaticField
getStaticField
(FieldDef field) Get static field.default VariableDef.StaticField
getStaticField
(Field field) Get static field.default VariableDef.StaticField
getStaticField
(String name, TypeDef type) Get static field.default ExpressionDef.NewInstance
instantiate
(io.micronaut.inject.ast.MethodElement methodElement, List<? extends ExpressionDef> values) The new instance expression.default ExpressionDef.NewInstance
instantiate
(ExpressionDef... values) The new instance expression.default ExpressionDef.NewInstance
instantiate
(Constructor<?> constructor, ExpressionDef... values) The new instance expression.default ExpressionDef.NewInstance
instantiate
(Constructor<?> constructor, List<? extends ExpressionDef> values) The new instance expression.default ExpressionDef.NewInstance
instantiate
(List<? extends ExpressionDef> values) The new instance expression.default ExpressionDef.NewInstance
instantiate
(List<TypeDef> parameterTypes, ExpressionDef... values) The new instance expression.default ExpressionDef.NewInstance
instantiate
(List<TypeDef> parameterTypes, List<? extends ExpressionDef> values) The new instance expression.default ExpressionDef.InvokeStaticMethod
invokeStatic
(io.micronaut.inject.ast.MethodElement methodElement, ExpressionDef... values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(io.micronaut.inject.ast.MethodElement methodElement, List<? extends ExpressionDef> values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(MethodDef method, ExpressionDef... values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(MethodDef method, List<? extends ExpressionDef> values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(Method method, ExpressionDef... values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(Method method, List<? extends ExpressionDef> values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(String name, TypeDef returningType, ExpressionDef... values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(String name, TypeDef returningType, List<? extends ExpressionDef> values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(String name, List<TypeDef> parameterTypes, TypeDef returningType, ExpressionDef... values) Invoke static method.default ExpressionDef.InvokeStaticMethod
invokeStatic
(String name, List<TypeDef> parameterTypes, TypeDef returningType, List<? extends ExpressionDef> values) Invoke static method.default boolean
isEnum()
default boolean
isInner()
default boolean
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.static ClassTypeDef
Create a new type definition.Methods inherited from interface io.micronaut.sourcegen.model.TypeDef
array, array, isArray, isNullable, isPrimitive
-
Field Details
-
OBJECT
-
-
Method Details
-
getName
String getName()- Returns:
- The type name
-
getCanonicalName
- Returns:
- The canonical type name
- Since:
- 1.5
-
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
-
isInterface
default boolean isInterface()- Returns:
- True if interface
- Since:
- 1.5
-
isInner
default boolean isInner()- Returns:
- True if inner
- Since:
- 1.5
-
instantiate
The new instance expression.- Parameters:
values
- The constructor values- Returns:
- The new instance
-
instantiate
The new instance expression.- Parameters:
values
- The constructor values- Returns:
- The new instance
-
instantiate
default ExpressionDef.NewInstance instantiate(List<TypeDef> parameterTypes, ExpressionDef... values) The new instance expression.- Parameters:
parameterTypes
- The constructor parameter typesvalues
- The constructor values- Returns:
- The new instance
-
instantiate
default ExpressionDef.NewInstance instantiate(List<TypeDef> parameterTypes, List<? extends ExpressionDef> values) The new instance expression.- Parameters:
parameterTypes
- The constructor parameter typesvalues
- The constructor values- Returns:
- The new instance
-
instantiate
The new instance expression.- Parameters:
constructor
- The constructorvalues
- The constructor values- Returns:
- The new instance
-
instantiate
default ExpressionDef.NewInstance instantiate(Constructor<?> constructor, List<? extends ExpressionDef> values) The new instance expression.- Parameters:
constructor
- The constructorvalues
- The constructor values- Returns:
- The new instance
-
instantiate
default ExpressionDef.NewInstance instantiate(io.micronaut.inject.ast.MethodElement methodElement, List<? extends ExpressionDef> values) The new instance expression.- Parameters:
methodElement
- The method elementvalues
- The constructor values- Returns:
- The new instance
-
getStaticField
Get static field.- Parameters:
name
- The field nametype
- The field type- Returns:
- the get static field expression
- Since:
- 1.5
-
getStaticField
Get static field.- Parameters:
field
- The field- Returns:
- the get static field expression
- Since:
- 1.5
-
getStaticField
Get static field.- Parameters:
field
- The field- Returns:
- the get static field expression
- Since:
- 1.5
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(String name, TypeDef returningType, List<? extends ExpressionDef> values) Invoke static method.- Parameters:
name
- The method namereturningType
- The return typevalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.2
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(String name, List<TypeDef> parameterTypes, TypeDef returningType, List<? extends ExpressionDef> values) Invoke static method.- Parameters:
name
- The method nameparameterTypes
- The parameter typesreturningType
- The return typevalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(String name, TypeDef returningType, ExpressionDef... values) Invoke static method.- Parameters:
name
- The method namereturningType
- The return typevalues
- The parameters- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(String name, List<TypeDef> parameterTypes, TypeDef returningType, ExpressionDef... values) Invoke static method.- Parameters:
name
- The method nameparameterTypes
- The parameter typesreturningType
- The return typevalues
- The parameters- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
Invoke static method.- Parameters:
method
- The methodvalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
Invoke static method.- Parameters:
method
- The methodvalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(Method method, List<? extends ExpressionDef> values) Invoke static method.- Parameters:
method
- The methodvalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(io.micronaut.inject.ast.MethodElement methodElement, ExpressionDef... values) Invoke static method.- Parameters:
methodElement
- The method elementvalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(io.micronaut.inject.ast.MethodElement methodElement, List<? extends ExpressionDef> values) Invoke static method.- Parameters:
methodElement
- The method elementvalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.5
-
invokeStatic
default ExpressionDef.InvokeStaticMethod invokeStatic(MethodDef method, List<? extends ExpressionDef> values) Invoke static method.- Parameters:
method
- The methodvalues
- The values- Returns:
- the invoke static method expression
- Since:
- 1.5
-
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:
className
- The class nameisInner
- Is inner type- Returns:
- type definition
- Since:
- 1.5
-
of
Create a new type definition.- Parameters:
classElement
- The class element- Returns:
- type definition
-
of
Create a new type definition.- Parameters:
objectDef
- The object definition- Returns:
- type definition
-
annotated
Define a ClassTypeDef with annotations. -
annotated
Define a ClassTypeDef with annotations.
-