public interface ArrayType extends Type
T
, the array type is written T[]
.
A component type may itself be an array type. For a component type T[]
,
the array type is written T[][]
. Such array type is also called
multi-dimensional array type.
Array types also have an element type, which is obtained by repeatedly
asking for the component type until a non-array type is returned. For example,
the String[][]
array type has an element type of String
.
Modifier and Type | Method and Description |
---|---|
default ArrayType |
asArray()
Returns this type as an array type.
|
Type |
componentType()
Returns the component type of this array type, as defined by The Java™ Language Specification.
|
default Type.Kind |
kind()
Returns the kind of this type.
|
asClass, asDeclaration, asParameterizedType, asPrimitive, asType, asTypeVariable, asVoid, asWildcardType, isArray, isClass, isDeclaration, isParameterizedType, isPrimitive, isType, isTypeVariable, isVoid, isWildcardType
annotation, annotations, annotations, hasAnnotation, hasAnnotation, repeatableAnnotation
Type componentType()
For example, the component type of int[]
is the int
type. The component type
of String[][]
is the String[]
array type, whose component type is the String
type.
Each dimension of the array type may be annotated independently.
null
default Type.Kind kind()
Type