public class NumberConverters extends Object
Attempts to convert a Number to the target datatype.
NOTE: precision may be lost when converting from a wide number to a narrower number (say float to integer). These
conversions are done by simply calling Number.intValue() and Number.floatValue() etc.
Conversions are as follows:
value.toString()value.intValue()value.intValue() > 0value.floatValue()value.doubleValue()value.longValue()value.byteValue()value.shortValue()Character.forDigit(value, 10) (Character.forDigit(int, int))| Modifier and Type | Class and Description |
|---|---|
static class |
NumberConverters.NumberBooleanFunction |
static class |
NumberConverters.NumberByteFunction |
static class |
NumberConverters.NumberCharacterFunction |
static class |
NumberConverters.NumberDoubleFunction |
static class |
NumberConverters.NumberFloatFunction |
static class |
NumberConverters.NumberIntegerFunction |
static class |
NumberConverters.NumberLongFunction |
static class |
NumberConverters.NumberShortFunction |
| Modifier and Type | Field and Description |
|---|---|
static Collection<ValueFunction<? extends Number,?>> |
NUMBER_CONVERTERS |
| Constructor and Description |
|---|
NumberConverters() |
public static final Collection<ValueFunction<? extends Number,?>> NUMBER_CONVERTERS
Copyright © 2018. All rights reserved.