Class NumberConverter
- java.lang.Object
-
- org.apache.qpid.server.query.engine.parsing.converter.NumberConverter
-
public final class NumberConverter extends Object
Utility class for numeric conversions
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisNumber(String source)Checks if string is a numberstatic Numbernarrow(Number number)Converts Number to the strictest numeric type available in following order: Integer, Long, Double, BigDecimalstatic <R> Rnarrow(BigDecimal bigDecimal)Converts BigDecimal to the strictest numeric type available in following order: Integer, Long, Double, BigDecimalstatic DoubletoDouble(Object value)Converts object to doublestatic LongtoLong(Object value)Converts object to long
-
-
-
Method Detail
-
toLong
public static Long toLong(Object value)
Converts object to long- Parameters:
value- Object to convert- Returns:
- Long instance
-
toDouble
public static Double toDouble(Object value)
Converts object to double- Parameters:
value- Object to convert- Returns:
- Double instance
-
narrow
public static <R> R narrow(BigDecimal bigDecimal)
Converts BigDecimal to the strictest numeric type available in following order: Integer, Long, Double, BigDecimal- Type Parameters:
R- Return parameter value- Parameters:
bigDecimal- BigDecimal instance- Returns:
- Converted value
-
narrow
public static Number narrow(Number number)
Converts Number to the strictest numeric type available in following order: Integer, Long, Double, BigDecimal- Parameters:
number- Number instance- Returns:
- Converted value
-
isNumber
public static boolean isNumber(String source)
Checks if string is a number- Parameters:
source- String to check- Returns:
- True or false
-
-