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 enumSpecifies the underlying Java primitive type for aPrimitiveTypeNested classes/interfaces inherited from class Type
Type.Builder<THIS>, Type.Kind -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PrimitiveTypeprivate static final Map<PrimitiveType.Primitive, ClassType> static final PrimitiveTypestatic final PrimitiveTypestatic final PrimitiveTypestatic final PrimitiveTypestatic final PrimitiveTypestatic final PrimitiveTypeprivate final PrimitiveType.Primitiveprivate static final Map<String, PrimitiveType> static final PrimitiveTypeprivate static final Map<DotName, PrimitiveType> Fields inherited from class Type
EMPTY_ARRAYFields inherited from interface Descriptor
NO_SUBSTITUTION -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrimitiveType(PrimitiveType.Primitive primitive) privatePrimitiveType(PrimitiveType.Primitive primitive, AnnotationInstance[] annotations) -
Method Summary
Modifier and TypeMethodDescriptionCasts this type to aPrimitiveTypeand returns it if the kind isType.Kind.PRIMITIVE.static ClassTypebox(PrimitiveType primitiveType) Returns a class type that is the result of a boxing conversion of the givenprimitiveType.(package private) TypecopyType(AnnotationInstance[] newAnnotations) (package private) static PrimitiveTypedecode(char c) (package private) static PrimitiveTypebooleanCompares thisTypewith another type.(package private) static PrimitiveTypefromOridinal(int ordinal) inthashCode()Computes a hash code representing this type.(package private) boolean(package private) intstatic booleanReturns whether the giventypeis a wrapper class for any primitive type (or, in other words, whether thetypemay be a result of a boxing conversion of any primitive type.)kind()Returns the kind of Type this is.The type of primitive this primitive type represents(package private) chartoCode()static PrimitiveTypeReturns a primitive type that is the result of an unboxing conversion of the givenclassType.Methods inherited from class Type
addAnnotation, annotation, annotationArray, annotations, annotationsWithRepeatable, appendAnnotations, asArrayType, asClassType, asParameterizedType, asTypeVariable, asTypeVariableReference, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, create, createWithAnnotations, descriptor, hasAnnotation, name, parse, toString, toString, withoutAnnotationsMethods inherited from interface Descriptor
descriptor
-
Field Details
-
BYTE
-
CHAR
-
DOUBLE
-
FLOAT
-
INT
-
LONG
-
SHORT
-
BOOLEAN
-
reverseMap
-
boxingMap
-
unboxingMap
-
primitive
-
-
Constructor Details
-
PrimitiveType
-
PrimitiveType
-
-
Method Details
-
kind
-
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
nullifprimitiveTypeisnull.- Parameters:
primitiveType- a primitive type, may benull- Returns:
- the corresponding class type, or
nullifprimitiveTypeisnull
-
isBox
Returns whether the giventypeis a wrapper class for any primitive type (or, in other words, whether thetypemay be a result of a boxing conversion of any primitive type.)Returns
falseiftypeis not aType.Kind.CLASSor whentypeisnull.- Parameters:
type- the type to check, may benull- Returns:
- whether the given
typeis a wrapper class for a primitive type
-
unbox
Returns a primitive type that is the result of an unboxing conversion of the givenclassType.Returns
nullif no unboxing conversion exists for given class type or ifclassTypeisnull.- Parameters:
classType- a class type, may benull- Returns:
- the corresponding primitive type, or
nullif there's none
-
asPrimitiveType
Description copied from class:TypeCasts this type to aPrimitiveTypeand returns it if the kind isType.Kind.PRIMITIVE. Throws an exception otherwise.- Overrides:
asPrimitiveTypein classType- Returns:
- a
PrimitiveType
-
copyType
-
toCode
char toCode() -
decode
-
decode
-
fromOridinal
-
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
-
internEquals
- Overrides:
internEqualsin classType
-
internHashCode
int internHashCode()- Overrides:
internHashCodein classType
-