Package org.jboss.jandex
Class ArrayType
java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.ArrayType
Represents a Java array type declaration.
- Author:
- Jason T. Greene
- Since:
- 2.0
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionCasts this type to anArrayTypeand returns it if the kind isType.Kind.ARRAY.Returns the component type of the array.static ArrayTypeCreate a new mock array type instance with the specified component and dimensions.intThe number of dimensions this array type has.booleanCompares thisTypewith another type.inthashCode()Computes a hash code representing this type.booleanintkind()Returns the kind of Type this is.name()Returns the raw name of this type.Methods inherited from class org.jboss.jandex.Type
annotation, annotations, annotationsWithRepeatable, asClassType, asParameterizedType, asPrimitiveType, asTypeVariable, asTypeVariableReference, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, createWithAnnotations, hasAnnotation, toString
-
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. For example,String[]has a component type ofString.It is possible for an
ArrayTypeto have anotherArrayTypeas its component type. This happens when an array has some of its dimensions annotated (e.g.String[] @Ann []). In such case, having multiple nestedArrayTypes is necessary to faithfully represent the annotations.- Returns:
- the component type
-
name
Description copied from class:TypeReturns the raw name of this type. Primitives and void are returned as the Java keyword (void, boolean, byte, short, int, long, float, double, char). 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 Numberhas a raw type ofNumber. -
dimensions
public int dimensions()The number of dimensions this array type has. For example, this method would return 2 for an array type ofString[][].Note that an
ArrayTypemay have anotherArrayTypeas its component type (seecomponent()). For example,String[] @Ann []is an array type with 1 dimension and a component type of another array type, also with 1 dimension.- Returns:
- the number of dimensions of this array type
-
kind
Description copied from class:TypeReturns the kind of Type this is. -
asArrayType
Description copied from class:TypeCasts this type to anArrayTypeand returns it if the kind isType.Kind.ARRAY. Throws an exception otherwise.- Overrides:
asArrayTypein classType- Returns:
- an
ArrayType
-
equals
Description copied from class:TypeCompares thisTypewith another type. A type is equal to another type if it is of the same kind, and all of their fields are equal. This includes annotations, which must be equal as well. -
hashCode
public int hashCode()Description copied from class:TypeComputes a hash code representing this type. -
internEquals
- Overrides:
internEqualsin classType
-
internHashCode
public int internHashCode()- Overrides:
internHashCodein classType
-