public final class ArrayType extends Type
Modifier and Type | Field and Description |
---|---|
private Type |
component |
private int |
dimensions |
private int |
hash |
EMPTY_ARRAY
Constructor and Description |
---|
ArrayType(Type component,
int dimensions) |
ArrayType(Type component,
int dimensions,
AnnotationInstance[] annotations) |
Modifier and Type | Method and Description |
---|---|
private void |
appendArraySyntax(java.lang.StringBuilder builder) |
private void |
appendRootComponent(java.lang.StringBuilder builder) |
ArrayType |
asArrayType()
Casts this type to an
ArrayType and returns it if the kind is
Type.Kind.ARRAY
Throws an exception otherwise. |
Type |
component()
Returns the component type of the array.
|
(package private) Type |
copyType(AnnotationInstance[] newAnnotations) |
(package private) Type |
copyType(Type component,
int dimensions) |
static ArrayType |
create(Type component,
int dimensions)
Create a new mock array type instance with the specified component
and dimensions.
|
int |
dimensions()
The number of dimensions this array type has.
|
boolean |
equals(java.lang.Object o)
Compares this Type with another type, and returns true if they are equivalent.
|
int |
hashCode()
Computes a hash code representing this type.
|
Type.Kind |
kind()
Returns the kind of Type this is.
|
DotName |
name()
Returns the raw name of this type.
|
java.lang.String |
toString()
Returns a string representation for this type.
|
addAnnotation, annotation, annotationArray, annotations, appendAnnotations, asClassType, asParameterizedType, asPrimitiveType, asTypeVariable, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, hasAnnotation, toString
private final Type component
private final int dimensions
private int hash
ArrayType(Type component, int dimensions)
ArrayType(Type component, int dimensions, AnnotationInstance[] annotations)
public static ArrayType create(Type component, int dimensions)
component
- the array componentdimensions
- the number of dimensions of this arraypublic Type component()
String[]
has a component type of String
public DotName name()
Type
DotName
.
Generic values are returned as the underlying raw value. For example,
a wildcard such as ? extends Number
, has a raw type of
Number
public java.lang.String toString()
Type
private void appendRootComponent(java.lang.StringBuilder builder)
private void appendArraySyntax(java.lang.StringBuilder builder)
public int dimensions()
String[][]
, would return a value
of 2.public ArrayType asArrayType()
Type
ArrayType
and returns it if the kind is
Type.Kind.ARRAY
Throws an exception otherwise.asArrayType
in class Type
ClassType
public boolean equals(java.lang.Object o)
Type
public int hashCode()
Type
Type copyType(AnnotationInstance[] newAnnotations)