Top Description Inners Methods
jakarta.enterprise.lang.model.types

public Interface Type

extends AnnotationTarget
Known Direct Subinterfaces
jakarta.enterprise.lang.model.types.TypeVariable, jakarta.enterprise.lang.model.types.VoidType, jakarta.enterprise.lang.model.types.WildcardType, jakarta.enterprise.lang.model.types.ArrayType, jakarta.enterprise.lang.model.types.ClassType, jakarta.enterprise.lang.model.types.ParameterizedType, jakarta.enterprise.lang.model.types.PrimitiveType
Imports
jakarta.enterprise.lang.model.AnnotationTarget, jakarta.enterprise.lang.model.declarations.ClassInfo, .DeclarationInfo

A type is used in a program source code, but does not have to be declared anywhere.

For example, the int type exists even if it is not declared in any Java source file, while the java.lang.String type is declared by the class of the same name. Array types, such as int[] or String[][], are not declared anywhere either, but their element types may be. A generic class, such as java.util.List, declares a raw type of the same name, but it does not declare the parameterized types, such as List<String>. Parameterized types are created by applying type arguments to generic classes. For example, the List<String> type is created by applying String to List<T>.

Types occur on many places. A field has a type, a method has a return type, a method parameter has a type, even the extends clause in a class declaration contains a type. Occurences of types may be annotated.

Types are:

Class types and parameterized types allow obtaining their class declarations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Method Summary

Modifier and TypeMethod and Description
public default ArrayType

Returns:

this array type, never null
asArray
()

Returns this type as an array type.

public default ClassType

Returns:

this class type, never null
asClass
()

Returns this type as a class type.

public default DeclarationInfo
public default ParameterizedType

Returns:

this parameterized type, never null
asParameterizedType
()

Returns this type as a parameterized type.

public default PrimitiveType

Returns:

this primitive type, never null
asPrimitive
()

Returns this type as a primitive type.

public default Type
asType()

Implements jakarta.enterprise.lang.model.AnnotationTarget.asType.

Returns this annotation target as a type.
public default TypeVariable

Returns:

this type variable, never null
asTypeVariable
()

Returns this type as a type variable.

public default VoidType

Returns:

this void type, never null
asVoid
()

Returns this type as the void pseudo-type.

public default WildcardType

Returns:

this wildcard type, never null
asWildcardType
()

Returns this type as a wildcard type.

public default boolean

Returns:

true if this is an array type, false otherwise
isArray
()

Returns whether this type is an array type.

public default boolean

Returns:

true if this is a class type, false otherwise
isClass
()

Returns whether this type is a class type.

public default boolean
isDeclaration()

Implements jakarta.enterprise.lang.model.AnnotationTarget.isDeclaration.

Returns whether this annotation target is a declaration.
public default boolean

Returns:

true if this is a parameterized type, false otherwise
isParameterizedType
()

Returns whether this type is a parameterized type.

public default boolean

Returns:

true if this is a primitive type, false otherwise
isPrimitive
()

Returns whether this type is a primitive type.

public default boolean
isType()

Implements jakarta.enterprise.lang.model.AnnotationTarget.isType.

Returns whether this annotation target is a type.
public default boolean

Returns:

true if this is a primitive type, false otherwise
isTypeVariable
()

Returns whether this type is a type variable.

public default boolean

Returns:

true if this is void, false otherwise
isVoid
()

Returns whether this type is the void pseudo-type.

public default boolean

Returns:

true if this is a wildcard type, false otherwise
isWildcardType
()

Returns whether this type is a wildcard type.

public Type.Kind

Returns:

the kind of this type
kind
()

Returns the kind of this type.

Inherited from jakarta.enterprise.lang.model.AnnotationTarget:
annotationannotationsannotationshasAnnotationhasAnnotationrepeatableAnnotation

Method Detail

asArrayback to summary
public default ArrayType asArray()

Returns this type as an array type.

Returns:ArrayType

this array type, never null

Exceptions
IllegalStateException:
if isArray() returns false
asClassback to summary
public default ClassType asClass()

Returns this type as a class type.

Returns:ClassType

this class type, never null

Exceptions
IllegalStateException:
if isClass() returns false
asDeclarationback to summary
public default DeclarationInfo asDeclaration()

Implements jakarta.enterprise.lang.model.AnnotationTarget.asDeclaration.

Doc from jakarta.enterprise.lang.model.AnnotationTarget.asDeclaration.

Returns this annotation target as a declaration.

Returns:DeclarationInfo

this declaration, never null

Annotations
@Override
asParameterizedTypeback to summary
public default ParameterizedType asParameterizedType()

Returns this type as a parameterized type.

Returns:ParameterizedType

this parameterized type, never null

Exceptions
IllegalStateException:
if isParameterizedType() returns false
asPrimitiveback to summary
public default PrimitiveType asPrimitive()

Returns this type as a primitive type.

Returns:PrimitiveType

this primitive type, never null

Exceptions
IllegalStateException:
if isPrimitive() returns false
asTypeback to summary
public default Type asType()

Implements jakarta.enterprise.lang.model.AnnotationTarget.asType.

Doc from jakarta.enterprise.lang.model.AnnotationTarget.asType.

Returns this annotation target as a type.

Returns:Type

this type, never null

Annotations
@Override
asTypeVariableback to summary
public default TypeVariable asTypeVariable()

Returns this type as a type variable. Type variables are also used to represent type parameters in declarations of parameterized types.

Returns:TypeVariable

this type variable, never null

Exceptions
IllegalStateException:
if isTypeVariable() returns false
asVoidback to summary
public default VoidType asVoid()

Returns this type as the void pseudo-type.

Returns:VoidType

this void type, never null

Exceptions
IllegalStateException:
if isVoid() returns false
asWildcardTypeback to summary
public default WildcardType asWildcardType()

Returns this type as a wildcard type.

Returns:WildcardType

this wildcard type, never null

Exceptions
IllegalStateException:
if isWildcardType() returns false
isArrayback to summary
public default boolean isArray()

Returns whether this type is an array type.

Returns:boolean

true if this is an array type, false otherwise

isClassback to summary
public default boolean isClass()

Returns whether this type is a class type.

Returns:boolean

true if this is a class type, false otherwise

isDeclarationback to summary
public default boolean isDeclaration()

Implements jakarta.enterprise.lang.model.AnnotationTarget.isDeclaration.

Doc from jakarta.enterprise.lang.model.AnnotationTarget.isDeclaration.

Returns whether this annotation target is a declaration.

Returns:boolean

true if this is a declaration, false otherwise

Annotations
@Override
isParameterizedTypeback to summary
public default boolean isParameterizedType()

Returns whether this type is a parameterized type.

Returns:boolean

true if this is a parameterized type, false otherwise

isPrimitiveback to summary
public default boolean isPrimitive()

Returns whether this type is a primitive type.

Returns:boolean

true if this is a primitive type, false otherwise

isTypeback to summary
public default boolean isType()

Implements jakarta.enterprise.lang.model.AnnotationTarget.isType.

Doc from jakarta.enterprise.lang.model.AnnotationTarget.isType.

Returns whether this annotation target is a type.

Returns:boolean

true if this is a type, false otherwise

Annotations
@Override
isTypeVariableback to summary
public default boolean isTypeVariable()

Returns whether this type is a type variable. Type variables are also used to represent type parameters in declarations of parameterized types.

Returns:boolean

true if this is a primitive type, false otherwise

isVoidback to summary
public default boolean isVoid()

Returns whether this type is the void pseudo-type.

Returns:boolean

true if this is void, false otherwise

isWildcardTypeback to summary
public default boolean isWildcardType()

Returns whether this type is a wildcard type.

Returns:boolean

true if this is a wildcard type, false otherwise

kindback to summary
public Type.Kind kind()

Returns the kind of this type.

Returns:Type.Kind

the kind of this type

jakarta.enterprise.lang.model.types back to summary

public final Enum Type.Kind

extends Enum<Type.Kind>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Type.Kind
ARRAY

E.g. when method returns int[] or String[][].

public static final Type.Kind
CLASS

E.g. when method returns String.

public static final Type.Kind
PARAMETERIZED_TYPE

E.g. when method returns List<String>.

public static final Type.Kind
PRIMITIVE

E.g. when method returns int.

public static final Type.Kind
TYPE_VARIABLE

E.g. when method returns T and T is a type parameter of the declaring class.

public static final Type.Kind
VOID

E.g. when method returns void.

public static final Type.Kind
WILDCARD_TYPE

E.g. when method returns List<?

Constructor Summary

AccessConstructor and Description
private
Kind()

Method Summary

Modifier and TypeMethod and Description
public static Type.Kind
public static Type.Kind[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ARRAYback to summary
public static final Type.Kind ARRAY

E.g. when method returns int[] or String[][].

CLASSback to summary
public static final Type.Kind CLASS

E.g. when method returns String.

PARAMETERIZED_TYPEback to summary
public static final Type.Kind PARAMETERIZED_TYPE

E.g. when method returns List<String>.

PRIMITIVEback to summary
public static final Type.Kind PRIMITIVE

E.g. when method returns int.

TYPE_VARIABLEback to summary
public static final Type.Kind TYPE_VARIABLE

E.g. when method returns T and T is a type parameter of the declaring class.

VOIDback to summary
public static final Type.Kind VOID

E.g. when method returns void.

WILDCARD_TYPEback to summary
public static final Type.Kind WILDCARD_TYPE

E.g. when method returns List<? extends Number>. The kind of such type is PARAMETERIZED_TYPE, but the first (and only) type argument is a WILDCARD_TYPE.

Constructor Detail

Kindback to summary
private Kind()

Method Detail

valueOfback to summary
public static Type.Kind valueOf(String name)
valuesback to summary
public static Type.Kind[] values()