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