Package org.jboss.jandex
Class ArrayType
- java.lang.Object
-
- org.jboss.jandex.Type
-
- org.jboss.jandex.ArrayType
-
public final class ArrayType extends Type
Represents a Java array type declaration.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description private Typecomponentprivate intdimensionsprivate inthash-
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description ArrayType(Type component, int dimensions)ArrayType(Type component, int dimensions, AnnotationInstance[] annotations)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidappendArraySyntax(java.lang.StringBuilder builder)private voidappendRootComponent(java.lang.StringBuilder builder)ArrayTypeasArrayType()Casts this type to anArrayTypeand returns it if the kind isType.Kind.ARRAYThrows an exception otherwise.Typecomponent()Returns the component type of the array.(package private) TypecopyType(AnnotationInstance[] newAnnotations)(package private) TypecopyType(Type component, int dimensions)static ArrayTypecreate(Type component, int dimensions)Create a new mock array type instance with the specified component and dimensions.intdimensions()The number of dimensions this array type has.booleanequals(java.lang.Object o)Compares this Type with another type, and returns true if they are equivalent.inthashCode()Computes a hash code representing this type.Type.Kindkind()Returns the kind of Type this is.DotNamename()Returns the raw name of this type.java.lang.StringtoString()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 Detail
-
component
private final Type component
-
dimensions
private final int dimensions
-
hash
private int hash
-
-
Constructor Detail
-
ArrayType
ArrayType(Type component, int dimensions)
-
ArrayType
ArrayType(Type component, int dimensions, AnnotationInstance[] annotations)
-
-
Method Detail
-
create
public static ArrayType create(Type component, int dimensions)
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
public Type component()
Returns the component type of the array. As an example,String[]has a component type ofString- Returns:
- the component type
-
name
public DotName name()
Description copied from class:TypeReturns 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
public java.lang.String toString()
Description copied from class:TypeReturns a string representation for this type. It is similar, yet not equivalent to a Java source code representation.
-
appendRootComponent
private void appendRootComponent(java.lang.StringBuilder builder)
-
appendArraySyntax
private void appendArraySyntax(java.lang.StringBuilder builder)
-
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
-
asArrayType
public ArrayType asArrayType()
Description copied from class:TypeCasts this type to anArrayTypeand returns it if the kind isType.Kind.ARRAYThrows an exception otherwise.- Overrides:
asArrayTypein classType- Returns:
- a
ClassType
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:TypeCompares 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:TypeComputes a hash code representing this type.
-
copyType
Type copyType(AnnotationInstance[] newAnnotations)
-
-