Class 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 Detail

      • OBJECT_TYPE

        public static final ClassType OBJECT_TYPE
      • STRING_TYPE

        public static final ClassType STRING_TYPE
      • CLASS_TYPE

        public static final ClassType CLASS_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
      • VOID_CLASS

        public static final ClassType VOID_CLASS
    • Method Detail

      • 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​(java.lang.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​(java.lang.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​(java.lang.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