Modifier and Type | Method and Description |
---|---|
static boolean |
isFloatingPoint(TypeKind typeKind)
Return true if the argument is one of FLOAT, DOUBLE.
|
static boolean |
isIntegral(TypeKind typeKind)
Return true if the argument is one of INT, SHORT, BYTE, CHAR, LONG.
|
static boolean |
isNarrower(TypeKind a,
TypeKind b)
Returns true if a widening conversion happens between the types.
|
static boolean |
isNumeric(TypeKind typeKind)
Returns true iff the argument is a primitive numeric type kind.
|
static @Nullable TypeKind |
primitiveOrBoxedToTypeKind(TypeMirror type)
Given a primitive type, return its kind.
|
static TypeKind |
widenedNumericType(TypeKind a,
TypeKind b)
Given two type kinds, return the type kind they are widened to, when an arithmetic operation
is performed on them.
|
static TypeKind |
widenedNumericType(TypeMirror left,
TypeMirror right)
Returns the widened numeric type for an arithmetic operation performed on a value of the left
type and the right type.
|
public static boolean isIntegral(TypeKind typeKind)
typeKind
- the TypeKind to inspectpublic static boolean isFloatingPoint(TypeKind typeKind)
typeKind
- the TypeKind to inspectpublic static boolean isNumeric(TypeKind typeKind)
typeKind
- a type kindpublic static @Nullable TypeKind primitiveOrBoxedToTypeKind(TypeMirror type)
type
- a primitive or boxed primitive typepublic static TypeKind widenedNumericType(TypeMirror left, TypeMirror right)
TypeKind
because creating
a TypeMirror
requires a Types
object from the ProcessingEnvironment
.left
- a type mirrorright
- a type mirrorpublic static TypeKind widenedNumericType(TypeKind a, TypeKind b)
a
- a type kindb
- a type kindpublic static boolean isNarrower(TypeKind a, TypeKind b)
a
- a primitive typeb
- a primitive typea
is represented by fewer bits than b