Class NumericalHelper
- java.lang.Object
-
- org.eclipse.emf.ecp.edit.internal.swt.controls.NumericalHelper
-
public final class NumericalHelper extends java.lang.Object- Author:
- Eugen Neufeld
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.NumbergetDefaultValue(java.lang.Class<?> instanceClass)Returns the default value for a given number instance class.static booleanisDouble(java.lang.Class<?> instanceClass)Whether the given class is a double.static booleanisInteger(java.lang.Class<?> instanceClass)Whether the given class is an integer.static java.lang.ObjectnumberToInstanceClass(java.lang.Number number, java.lang.Class<?> instanceClass)Converts the given number to an value of the instance class type.static java.text.DecimalFormatsetupFormat(java.util.Locale locale, java.lang.Class<?> instanceClass)Sets up aDecimalFormatbased on the given locale on instance class.
-
-
-
Method Detail
-
setupFormat
public static java.text.DecimalFormat setupFormat(java.util.Locale locale, java.lang.Class<?> instanceClass)Sets up aDecimalFormatbased on the given locale on instance class.- Parameters:
locale- the locale of the current applicationinstanceClass- the instance class of the number- Returns:
- the format
-
getDefaultValue
public static java.lang.Number getDefaultValue(java.lang.Class<?> instanceClass)
Returns the default value for a given number instance class.- Parameters:
instanceClass- the class- Returns:
- the default value
-
isDouble
public static boolean isDouble(java.lang.Class<?> instanceClass)
Whether the given class is a double.- Parameters:
instanceClass- the class to check- Returns:
trueif double,falseotherwise
-
isInteger
public static boolean isInteger(java.lang.Class<?> instanceClass)
Whether the given class is an integer.- Parameters:
instanceClass- the class to check- Returns:
trueif integer,falseotherwise
-
numberToInstanceClass
public static java.lang.Object numberToInstanceClass(java.lang.Number number, java.lang.Class<?> instanceClass)Converts the given number to an value of the instance class type.- Parameters:
number- the number to convertinstanceClass- the instance which the result must conform to- Returns:
- the converted value
-
-