Package org.jboss.jandex
Class PrimitiveType
java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.PrimitiveType
- All Implemented Interfaces:
Descriptor
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. Instead
equals(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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Specifies the underlying Java primitive type for aPrimitiveType
Nested classes/interfaces inherited from class org.jboss.jandex.Type
Type.Builder<THIS extends Type.Builder<THIS>>, Type.Kind
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PrimitiveType
private static final Map
<PrimitiveType.Primitive, ClassType> static final PrimitiveType
static final PrimitiveType
static final PrimitiveType
static final PrimitiveType
static final PrimitiveType
static final PrimitiveType
private final PrimitiveType.Primitive
private static final Map
<String, PrimitiveType> static final PrimitiveType
private static final Map
<DotName, PrimitiveType> Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
Fields inherited from interface org.jboss.jandex.Descriptor
NO_SUBSTITUTION
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
PrimitiveType
(PrimitiveType.Primitive primitive) private
PrimitiveType
(PrimitiveType.Primitive primitive, AnnotationInstance[] annotations) -
Method Summary
Modifier and TypeMethodDescriptionCasts this type to aPrimitiveType
and returns it if the kind isType.Kind.PRIMITIVE
.static ClassType
box
(PrimitiveType primitiveType) Returns a class type that is the result of a boxing conversion of the givenprimitiveType
.(package private) Type
copyType
(AnnotationInstance[] newAnnotations) (package private) static PrimitiveType
decode
(char c) (package private) static PrimitiveType
boolean
Compares thisType
with another type.(package private) static PrimitiveType
fromOridinal
(int ordinal) int
hashCode()
Computes a hash code representing this type.(package private) boolean
(package private) int
kind()
Returns the kind of Type this is.The type of primitive this primitive type represents(package private) char
toCode()
static PrimitiveType
Returns a primitive type that is the result of an unboxing conversion of the givenclassType
.Methods inherited from class org.jboss.jandex.Type
addAnnotation, annotation, annotationArray, annotations, annotationsWithRepeatable, appendAnnotations, asArrayType, asClassType, asParameterizedType, asTypeVariable, asTypeVariableReference, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, create, createWithAnnotations, descriptor, hasAnnotation, name, parse, toString, toString, withoutAnnotations
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jboss.jandex.Descriptor
descriptor
-
Field Details
-
BYTE
-
CHAR
-
DOUBLE
-
FLOAT
-
INT
-
LONG
-
SHORT
-
BOOLEAN
-
reverseMap
-
boxingMap
-
unboxingMap
-
primitive
-
-
Constructor Details
-
PrimitiveType
-
PrimitiveType
-
-
Method Details
-
kind
Description copied from class:Type
Returns the kind of Type this is. -
primitive
The type of primitive this primitive type represents- Returns:
- the primitive
-
box
Returns a class type that is the result of a boxing conversion of the givenprimitiveType
.Returns
null
ifprimitiveType
isnull
.- Parameters:
primitiveType
- a primitive type, may benull
- Returns:
- the corresponding class type, or
null
ifprimitiveType
isnull
-
unbox
Returns a primitive type that is the result of an unboxing conversion of the givenclassType
.Returns
null
if no unboxing conversion exists for given class type or ifclassType
isnull
.- Parameters:
classType
- a class type, may benull
- Returns:
- the corresponding primitive type, or
null
if there's none
-
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
PrimitiveType
-
copyType
-
toCode
char toCode() -
decode
-
decode
-
fromOridinal
-
equals
Description copied from class:Type
Compares thisType
with 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:Type
Computes a hash code representing this type. -
internEquals
- Overrides:
internEquals
in classType
-
internHashCode
int internHashCode()- Overrides:
internHashCode
in classType
-