public interface MathUtilLimited
MathUtil
that is GWT compatible.Modifier and Type | Method and Description |
---|---|
NumberType<? extends Number> |
getNumberType(Class<?> numericType)
This method gets the
NumberType for the given numericType . |
<NUMBER extends Number> |
getNumberTypeGeneric(Class<NUMBER> numericType)
This method gets the
NumberType for the given numericType . |
Number |
toSimplestNumber(Number value)
This method converts the given value to the simplest suitable
number-type . |
NumberType<? extends Number> getNumberType(Class<?> numericType)
NumberType
for the given numericType
.numericType
- is the class reflecting a Number
. It may be primitive
(such
as int.class
). The signature is NOT bound to Number
to make it easy for the caller (e.g.
Number.class.isAssignableFrom(int.class)
is false
).NumberType
representing the given numericType
or null
if the given
numericType
is no Number
or is NOT known (you may extend this MathUtilLimited
in
such case).getNumberTypeGeneric(Class)
<NUMBER extends Number> NumberType<NUMBER> getNumberTypeGeneric(Class<NUMBER> numericType)
NumberType
for the given numericType
.NUMBER
- is the generic type of the numericType
.numericType
- is the class reflecting a Number
. It may be primitive
(such
as int.class
).NumberType
representing the given numericType
or null
if the given
numericType
is NOT known (you may extend this MathUtilLimited
in such case).Number toSimplestNumber(Number value)
number-type
. The ordering
implied by "simplest" is Byte
< Short
< Integer
< Long
< Float
< Double
. Double
is only converted to Float
if the result is exactly the same. Be
aware that 0.2F - 0.2
is NOT 0.0
(but 2.980232227667301E-9
).value
- is the value to convert.Number.doubleValue()
as the given value and the simplest possible type.Copyright © 2001–2016 mmm-Team. All rights reserved.