Package org.jboss.jandex
Class ArrayType
java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.ArrayType
Represents a Java array type declaration.
- Since:
- 2.0
-
Nested Class Summary
-
Field Summary
FieldsFields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
appendArraySyntax
(StringBuilder builder) private void
appendRootComponent
(StringBuilder builder) Casts this type to anArrayType
and returns it if the kind isType.Kind.ARRAY
Throws an exception otherwise.Returns the component type of the array.(package private) Type
copyType
(AnnotationInstance[] newAnnotations) (package private) Type
static ArrayType
Create a new mock array type instance with the specified component and dimensions.int
The number of dimensions this array type has.boolean
Compares this Type with another type, and returns true if they are equivalent.int
hashCode()
Computes a hash code representing this type.kind()
Returns the kind of Type this is.name()
Returns the raw name of this type.toString()
Returns a string representation for this type.Methods inherited from class org.jboss.jandex.Type
addAnnotation, annotation, annotationArray, annotations, appendAnnotations, asClassType, asParameterizedType, asPrimitiveType, asTypeVariable, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, hasAnnotation, toString
-
Field Details
-
component
-
dimensions
private final int dimensions -
hash
private int hash
-
-
Constructor Details
-
ArrayType
ArrayType(Type component, int dimensions) -
ArrayType
ArrayType(Type component, int dimensions, AnnotationInstance[] annotations)
-
-
Method Details
-
create
Create a new mock array type instance with the specified component and dimensions.- Parameters:
component
- the array componentdimensions
- the number of dimensions of this array- Returns:
- the new mock array type instance
- Since:
- 2.1
-
component
Returns the component type of the array. As an example,String[]
has a component type ofString
- Returns:
- the component type
-
name
Description copied from class:Type
Returns the raw name of this type. Primitives and void are returned as the Java reserved word (void, boolean, byte, short, char, int, long, float, double). Arrays are returned using the Java reflection array syntax (e.g. "[[[Ljava.lang.String;") Classes are returned as a normalDotName
.Generic values are returned as the underlying raw value. For example, a wildcard such as
? extends Number
, has a raw type ofNumber
-
toString
Description copied from class:Type
Returns a string representation for this type. It is similar, yet not equivalent to a Java source code representation. -
appendRootComponent
-
appendArraySyntax
-
dimensions
public int dimensions()The number of dimensions this array type has. For example,String[][]
, would return a value of 2.- Returns:
- the number of dimensions of this array type
-
kind
Description copied from class:Type
Returns the kind of Type this is. -
asArrayType
Description copied from class:Type
Casts this type to anArrayType
and returns it if the kind isType.Kind.ARRAY
Throws an exception otherwise.- Overrides:
asArrayType
in classType
- Returns:
- a
ClassType
-
equals
Description copied from class:Type
Compares this Type with another type, and returns true if they are equivalent. A type is equivalent to another type if it is the same kind, and all of its fields are equal. This includes annotations, which must be equal as well. -
hashCode
public int hashCode()Description copied from class:Type
Computes a hash code representing this type. -
copyType
-
copyType
-