Class ClassType

java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.ClassType
All Implemented Interfaces:
Descriptor

public final class ClassType extends Type
Represents a class type. Class types also include erasures of parameterized types.

Note that an inner class type enclosed in a parameterized type or in a type annotated with a type annotation is represented as ParameterizedType, where the enclosing type is represented as the parameterized type's owner.

  • Field Details

    • OBJECT_TYPE

      public static final ClassType OBJECT_TYPE
    • BYTE_CLASS

      public static final ClassType BYTE_CLASS
    • CHARACTER_CLASS

      public static final ClassType CHARACTER_CLASS
    • DOUBLE_CLASS

      public static final ClassType DOUBLE_CLASS
    • FLOAT_CLASS

      public static final ClassType FLOAT_CLASS
    • INTEGER_CLASS

      public static final ClassType INTEGER_CLASS
    • LONG_CLASS

      public static final ClassType LONG_CLASS
    • SHORT_CLASS

      public static final ClassType SHORT_CLASS
    • BOOLEAN_CLASS

      public static final ClassType BOOLEAN_CLASS
  • Constructor Details

  • Method Details

    • create

      public static ClassType create(DotName name)
      Create an instance of a class type with given name.

      Note that an inner class type enclosed in a parameterized type or in a type annotated with a type annotation is represented as ParameterizedType, where the enclosing type is represented as the parameterized type's owner.

      Parameters:
      name - the binary name of this class type
      Returns:
      the class type
      Since:
      3.0.4
    • create

      public static ClassType create(String name)
      Create an instance of a class type with given name.

      Note that an inner class type enclosed in a parameterized type or in a type annotated with a type annotation is represented as ParameterizedType, where the enclosing type is represented as the parameterized type's owner.

      Parameters:
      name - the binary name of this class type
      Returns:
      the class type
      Since:
      3.1.0
    • create

      public static ClassType create(Class<?> clazz)
      Create an instance of a class type for given clazz.

      Note that an inner class type enclosed in a parameterized type or in a type annotated with a type annotation is represented as ParameterizedType, where the enclosing type is represented as the parameterized type's owner.

      Parameters:
      clazz - the class
      Returns:
      the class type
      Since:
      3.1.0
    • builder

      public static ClassType.Builder builder(DotName name)
      Create a builder of a class type with the given name.
      Parameters:
      name - binary name of the class
      Returns:
      the builder
      Since:
      3.1.0
    • builder

      public static ClassType.Builder builder(Class<?> clazz)
      Create a builder of a class type for the given class.
      Parameters:
      clazz - the class
      Returns:
      the builder
      Since:
      3.1.0
    • kind

      public Type.Kind kind()
      Description copied from class: Type
      Returns the kind of Type this is.
      Specified by:
      kind in class Type
      Returns:
      the kind
    • asClassType

      public ClassType asClassType()
      Description copied from class: Type
      Casts this type to a ClassType and returns it if the kind is Type.Kind.CLASS. Throws an exception otherwise.
      Overrides:
      asClassType in class Type
      Returns:
      a ClassType
    • copyType

      Type copyType(AnnotationInstance[] newAnnotations)
      Specified by:
      copyType in class Type
    • toParameterizedType

      ParameterizedType toParameterizedType()