public final class NumericalHelper extends Object
Modifier and Type | Method and Description |
---|---|
static Number |
getDefaultValue(Class<?> instanceClass)
Returns the default value for a given number instance class.
|
static boolean |
isDouble(Class<?> instanceClass)
Whether the given class is a double.
|
static boolean |
isInteger(Class<?> instanceClass)
Whether the given class is an integer.
|
static Object |
numberToInstanceClass(Number number,
Class<?> instanceClass)
Converts the given number to an value of the instance class type.
|
static DecimalFormat |
setupFormat(Locale locale,
Class<?> instanceClass)
Sets up a
DecimalFormat based on the given locale on instance class. |
public static DecimalFormat setupFormat(Locale locale, Class<?> instanceClass)
DecimalFormat
based on the given locale on instance class.locale
- the locale of the current applicationinstanceClass
- the instance class of the numberpublic static Number getDefaultValue(Class<?> instanceClass)
instanceClass
- the classpublic static boolean isDouble(Class<?> instanceClass)
instanceClass
- the class to checktrue
if double, false
otherwisepublic static boolean isInteger(Class<?> instanceClass)
instanceClass
- the class to checktrue
if integer, false
otherwisepublic static Object numberToInstanceClass(Number number, Class<?> instanceClass)
number
- the number to convertinstanceClass
- the instance which the result must conform toCopyright © 2018. All rights reserved.