public final class TypeUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
arrayEqual(java.lang.Object left,
java.lang.Object right) |
static java.math.BigDecimal |
castToBigDecimal(java.lang.Object value) |
static java.math.BigDecimal |
castToBigDecimal(java.lang.Object value,
java.math.BigDecimal defaultValue) |
static java.math.BigInteger |
castToBigInteger(java.lang.Object value) |
static java.math.BigInteger |
castToBigInteger(java.lang.Object value,
java.math.BigInteger defaultValue) |
static boolean |
castToBoolean(java.lang.Object value) |
static boolean |
castToBoolean(java.lang.Object value,
boolean defaultValue) |
static byte |
castToByte(java.lang.Object value) |
static byte |
castToByte(java.lang.Object value,
byte defaultValue) |
static char |
castToChar(java.lang.Object value) |
static char |
castToChar(java.lang.Object value,
char defaultValue) |
static double |
castToDouble(java.lang.Object value) |
static double |
castToDouble(java.lang.Object value,
double defaultValue) |
static float |
castToFloat(java.lang.Object value) |
static float |
castToFloat(java.lang.Object value,
float defaultValue) |
static int |
castToInt(java.lang.Object value) |
static int |
castToInt(java.lang.Object value,
int defaultValue) |
static long |
castToLong(java.lang.Object value) |
static long |
castToLong(java.lang.Object value,
long defaultValue) |
static java.lang.Number |
castToNumber(java.lang.Object value) |
static java.lang.Number |
castToNumber(java.lang.Object value,
java.lang.Number defaultValue) |
static short |
castToShort(java.lang.Object value) |
static short |
castToShort(java.lang.Object value,
short defaultValue) |
static int |
compareTo(java.lang.Character left,
java.lang.Character right) |
static int |
compareTo(java.lang.Character left,
java.lang.Number right) |
static int |
compareTo(java.lang.Number left,
java.lang.Character right) |
static int |
compareTo(java.lang.Number left,
java.lang.Number right) |
static int |
compareTo(java.lang.Object left,
java.lang.Object right) |
static <T> T |
convertValue(java.lang.Class<T> targetType,
java.lang.Object value) |
static <T> T |
convertValue(java.lang.Class<T> targetType,
java.lang.Object value,
java.lang.String format) |
static boolean |
equals(int[] left,
int[] right)
Compare the contents of this array to the contents of the given array.
|
static <T> boolean |
equals(java.util.List<T> left,
java.util.List<T> right)
Compare the contents of two Lists.
|
static boolean |
equals(java.util.List left,
java.lang.Object[] right)
Determines if the contents of this list are equal to the
contents of the given array in the same order.
|
static <K,V> boolean |
equals(java.util.Map<K,V> left,
java.util.Map<K,V> right)
Compares two Maps treating coerced numerical values as identical.
|
static boolean |
equals(java.lang.Object[] left,
java.util.List right)
Determines if the contents of this array are equal to the
contents of the given list, in the same order.
|
static boolean |
equals(java.lang.Object left,
java.lang.Object right) |
static <T> boolean |
equals(java.util.Set<T> left,
java.util.Set<T> right)
Compare the contents of two Sets for equality using Groovy's coercion rules.
|
static boolean |
isBigDecimal(java.lang.Class<?> type) |
static boolean |
isBigDecimal(java.lang.Number number) |
static boolean |
isBigInteger(java.lang.Class<?> type) |
static boolean |
isBigInteger(java.lang.Number number) |
static boolean |
isBoolean(java.lang.Class<?> type) |
static boolean |
isByte(java.lang.Class<?> type) |
static boolean |
isCharacter(java.lang.Class<?> type) |
static boolean |
isDouble(java.lang.Class<?> type) |
static boolean |
isFloat(java.lang.Class<?> type) |
static boolean |
isFloatingPoint(java.lang.Number number) |
static boolean |
isInteger(java.lang.Class<?> type) |
static boolean |
isInteger(java.lang.Number number) |
static boolean |
isLong(java.lang.Class<?> type) |
static boolean |
isLong(java.lang.Number number) |
static boolean |
isNumber(java.lang.Class<?> type) |
static boolean |
isShort(java.lang.Class<?> type) |
static java.util.List |
primitiveArrayToList(java.lang.Object array)
Allows conversion of arrays into a mutable List
|
public static boolean castToBoolean(@Nonnull java.lang.Object value)
public static char castToChar(@Nonnull java.lang.Object value)
public static byte castToByte(@Nonnull java.lang.Object value)
public static short castToShort(@Nonnull java.lang.Object value)
public static int castToInt(@Nonnull java.lang.Object value)
public static long castToLong(@Nonnull java.lang.Object value)
public static float castToFloat(@Nonnull java.lang.Object value)
public static double castToDouble(@Nonnull java.lang.Object value)
public static java.math.BigInteger castToBigInteger(@Nonnull java.lang.Object value)
public static java.math.BigDecimal castToBigDecimal(@Nonnull java.lang.Object value)
@Nullable public static java.lang.Number castToNumber(@Nonnull java.lang.Object value)
public static boolean castToBoolean(@Nullable java.lang.Object value, boolean defaultValue)
public static char castToChar(@Nullable java.lang.Object value, char defaultValue)
public static byte castToByte(@Nullable java.lang.Object value, byte defaultValue)
public static short castToShort(@Nullable java.lang.Object value, short defaultValue)
public static int castToInt(@Nullable java.lang.Object value, int defaultValue)
public static long castToLong(@Nullable java.lang.Object value, long defaultValue)
public static float castToFloat(@Nullable java.lang.Object value, float defaultValue)
public static double castToDouble(@Nullable java.lang.Object value, double defaultValue)
@Nullable public static java.lang.Number castToNumber(@Nullable java.lang.Object value, @Nullable java.lang.Number defaultValue)
@Nullable public static java.math.BigInteger castToBigInteger(@Nullable java.lang.Object value, @Nullable java.math.BigInteger defaultValue)
@Nullable public static java.math.BigDecimal castToBigDecimal(@Nullable java.lang.Object value, @Nullable java.math.BigDecimal defaultValue)
@Nonnull public static <T> T convertValue(@Nonnull java.lang.Class<T> targetType, @Nonnull java.lang.Object value)
@Nonnull public static <T> T convertValue(@Nonnull java.lang.Class<T> targetType, @Nonnull java.lang.Object value, @Nullable java.lang.String format)
public static boolean isBoolean(@Nonnull java.lang.Class<?> type)
public static boolean isCharacter(@Nonnull java.lang.Class<?> type)
public static boolean isByte(@Nonnull java.lang.Class<?> type)
public static boolean isShort(@Nonnull java.lang.Class<?> type)
public static boolean isInteger(@Nonnull java.lang.Class<?> type)
public static boolean isLong(@Nonnull java.lang.Class<?> type)
public static boolean isFloat(@Nonnull java.lang.Class<?> type)
public static boolean isDouble(@Nonnull java.lang.Class<?> type)
public static boolean isBigInteger(@Nonnull java.lang.Class<?> type)
public static boolean isBigDecimal(@Nonnull java.lang.Class<?> type)
public static boolean isNumber(@Nonnull java.lang.Class<?> type)
public static boolean equals(@Nullable java.lang.Object left, @Nullable java.lang.Object right)
public static boolean arrayEqual(@Nullable java.lang.Object left, @Nullable java.lang.Object right)
public static boolean equals(int[] left, int[] right)
left
- an int arrayright
- the array being comparedpublic static boolean equals(java.lang.Object[] left, java.util.List right)
false
if either collection is null
.left
- an arrayright
- the List being comparedpublic static boolean equals(java.util.List left, java.lang.Object[] right)
false
if either collection is null
.left
- a Listright
- the Object[] being compared topublic static <T> boolean equals(java.util.List<T> left, java.util.List<T> right)
null
, the result
is true; rightwise if either list is null
, the result
is false
.left
- a Listright
- the List being compared totrue
if the contents of both lists are identical,
false
rightwise.public static <T> boolean equals(java.util.Set<T> left, java.util.Set<T> right)
null
, the result
is true; rightwise if either set is null
, the result
is false
.left
- a Setright
- the Set being compared topublic static <K,V> boolean equals(java.util.Map<K,V> left, java.util.Map<K,V> right)
left
- this Mapright
- the Map being compared topublic static java.util.List primitiveArrayToList(java.lang.Object array)
array
- an arraypublic static int compareTo(java.lang.Object left, java.lang.Object right)
public static int compareTo(java.lang.Character left, java.lang.Number right)
public static int compareTo(java.lang.Number left, java.lang.Character right)
public static int compareTo(java.lang.Character left, java.lang.Character right)
public static int compareTo(java.lang.Number left, java.lang.Number right)
public static boolean isFloatingPoint(java.lang.Number number)
public static boolean isInteger(java.lang.Number number)
public static boolean isLong(java.lang.Number number)
public static boolean isBigDecimal(java.lang.Number number)
public static boolean isBigInteger(java.lang.Number number)