public class NumberUtils extends Object
Constructor and Description |
---|
NumberUtils() |
Modifier and Type | Method and Description |
---|---|
static List<? extends Number> |
castNumbers(TypeMirror type,
List<? extends Number> numbers)
Converts a
List<A> to a List<B> , where A and B are numeric types. |
static Range |
castRange(TypeMirror type,
Range range)
Return a range that restricts the given range to the given type.
|
static boolean |
isFloatingPoint(TypeMirror type)
Return true if the argument TypeMirror is a (possibly boxed) floating point type.
|
static boolean |
isIntegral(TypeMirror type)
Return true if the argument TypeMirror is a (possibly boxed) integral type.
|
static boolean |
isPrimitiveFloatingPoint(TypeKind typeKind)
Return true if the argument is one of FLOAT, DOUBLE.
|
static boolean |
isPrimitiveIntegral(TypeKind typeKind)
Return true if the argument is one of INT, SHORT, BYTE, CHAR, LONG.
|
static TypeKind |
unboxPrimitive(TypeMirror type)
Given a primitive type, return it.
|
public static List<? extends Number> castNumbers(TypeMirror type, List<? extends Number> numbers)
List<A>
to a List<B>
, where A and B are numeric types.public static Range castRange(TypeMirror type, Range range)
type
- the type for the cast; the result will be within itrange
- the original range; the result will be within itpublic static TypeKind unboxPrimitive(TypeMirror type)
type
- a primitive or boxed primitive typepublic static boolean isIntegral(TypeMirror type)
type
- the type to inspectpublic static boolean isPrimitiveIntegral(TypeKind typeKind)
typeKind
- the TypeKind to inspectpublic static boolean isFloatingPoint(TypeMirror type)
type
- the type to inspectpublic static boolean isPrimitiveFloatingPoint(TypeKind typeKind)
typeKind
- the TypeKind to inspect