Package org.jboss.jandex
Class PrimitiveType
- java.lang.Object
-
- org.jboss.jandex.Type
-
- org.jboss.jandex.PrimitiveType
-
public final class PrimitiveType extends Type
Represents a primitive Java type. While a set of constants is provided for easy of use, instance equality should not be used to compare to them. Insteadequals(Object)
should be used.A primitive is considered equal to another primitive if it specifies the same primitive enumeration value, and contains an equal set of annotation instances.
- Since:
- 2.0
- Author:
- Jason T. Greene
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PrimitiveType.Primitive
Specifies the underlying Java primitive type for aPrimitiveType
-
Field Summary
Fields Modifier and Type Field Description static PrimitiveType
BOOLEAN
static PrimitiveType
BYTE
static PrimitiveType
CHAR
static PrimitiveType
DOUBLE
static PrimitiveType
FLOAT
static PrimitiveType
INT
static PrimitiveType
LONG
static PrimitiveType
SHORT
-
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PrimitiveType
asPrimitiveType()
Casts this type to aPrimitiveType
and returns it if the kind isType.Kind.PRIMITIVE
Throws an exception otherwise.boolean
equals(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.PrimitiveType.Primitive
primitive()
The type of primitive this primitive type represents-
Methods inherited from class org.jboss.jandex.Type
annotation, annotations, asArrayType, asClassType, asParameterizedType, asTypeVariable, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, hasAnnotation, name, toString
-
-
-
-
Field Detail
-
BYTE
public static final PrimitiveType BYTE
-
CHAR
public static final PrimitiveType CHAR
-
DOUBLE
public static final PrimitiveType DOUBLE
-
FLOAT
public static final PrimitiveType FLOAT
-
INT
public static final PrimitiveType INT
-
LONG
public static final PrimitiveType LONG
-
SHORT
public static final PrimitiveType SHORT
-
BOOLEAN
public static final PrimitiveType BOOLEAN
-
-
Method Detail
-
primitive
public PrimitiveType.Primitive primitive()
The type of primitive this primitive type represents- Returns:
- the primitive
-
asPrimitiveType
public PrimitiveType asPrimitiveType()
Description copied from class:Type
Casts this type to aPrimitiveType
and returns it if the kind isType.Kind.PRIMITIVE
Throws an exception otherwise.- Overrides:
asPrimitiveType
in classType
- Returns:
- a
ClassType
-
equals
public boolean equals(Object o)
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.- Overrides:
equals
in classType
- Parameters:
o
- the type to compare to- Returns:
- true if equal
- See Also:
Object.equals(Object)
-
-