Interface ClassTypeDef

All Superinterfaces:
TypeDef
All Known Implementing Classes:
ClassTypeDef.ClassDefType, ClassTypeDef.ClassElementType, ClassTypeDef.ClassName, ClassTypeDef.JavaClass, ClassTypeDef.Parameterized

The class type definition. Not-null by default.
Since:
1.0
Author:
Denis Stepanov
  • Field Details

  • Method Details

    • getName

      String getName()
      Returns:
      The type name
    • getSimpleName

      default String getSimpleName()
      Returns:
      The simple name
    • getPackageName

      default String getPackageName()
      Returns:
      The package name
    • makeNullable

      ClassTypeDef makeNullable()
      Specified by:
      makeNullable in interface TypeDef
      Returns:
      A new nullable type
    • isEnum

      default boolean isEnum()
      Returns:
      True if the class is an enum
      Since:
      1.2
    • instantiate

      default ExpressionDef instantiate()
      Instantiate this class.
      Returns:
      The instantiate expression
    • doThrow

      default StatementDef doThrow(List<ExpressionDef> parameters)
      Throw an exception.
      Parameters:
      parameters - The exception constructor parameters
      Returns:
      The instantiate expression
      Since:
      1.2
    • doThrow

      default StatementDef doThrow(ExpressionDef... parameters)
      Throw an exception.
      Parameters:
      parameters - The exception constructor parameters
      Returns:
      The instantiate expression
      Since:
      1.2
    • instantiate

      default ExpressionDef instantiate(List<ExpressionDef> parameters)
      Instantiate this class.
      Parameters:
      parameters - The constructor parameters
      Returns:
      The instantiate expression
    • instantiate

      default ExpressionDef instantiate(ExpressionDef... values)
      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 name
      parameters - The parameters
      returningType - 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 name
      parameters - The parameters
      returningType - The return type
      Returns:
      the invoke static method expression
      Since:
      1.2
    • of

      static ClassTypeDef of(Class<?> type)
      Create a new type definition.
      Parameters:
      type - The class
      Returns:
      type definition
    • of

      static ClassTypeDef of(String className)
      Create a new type definition.
      Parameters:
      className - The class name
      Returns:
      type definition
    • of

      static ClassTypeDef of(io.micronaut.inject.ast.ClassElement classElement)
      Create a new type definition.
      Parameters:
      classElement - The class element
      Returns:
      type definition
    • of

      static ClassTypeDef of(ClassDef classDef)
      Create a new type definition.
      Parameters:
      classDef - The class definition
      Returns:
      type definition
    • annotated

      default ClassTypeDef.AnnotatedClassTypeDef annotated(AnnotationDef... annotations)
      Define a ClassTypeDef with annotations.
      Specified by:
      annotated in interface TypeDef
      Parameters:
      annotations - the annotation definitions to be added
      Returns:
      The AnnotatedClassTypeDef
      Since:
      1.4
    • annotated

      default ClassTypeDef.AnnotatedClassTypeDef annotated(List<AnnotationDef> annotations)
      Define a ClassTypeDef with annotations.
      Specified by:
      annotated in interface TypeDef
      Parameters:
      annotations - The list of the AnnotationDef
      Returns:
      The AnnotatedClassTypeDef
      Since:
      1.4