Class NumericConverterImpl
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.utility.NumericConverterImpl
-
- All Implemented Interfaces:
NumericConverter
public class NumericConverterImpl extends Object implements NumericConverter
This is a concrete implementation class for numeric conversion to BigDecimal or BigInteger. For conversion to BigInteger, we truncate the fraction part of the number.- Author:
- Shing Wai Chan
-
-
Field Summary
-
Fields inherited from interface com.sun.jdo.spi.persistence.support.sqlstore.utility.NumericConverter
DEFAULT_POLICY
-
-
Constructor Summary
Constructors Constructor Description NumericConverterImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimal
toBigDecimal(Double d)
To convert Double to BigDecimal.BigDecimal
toBigDecimal(Float f)
To convert Float to BigDecimal.BigDecimal
toBigDecimal(Number n)
To convert Number other than BigInteger, Double and Float to BigDecimal.BigDecimal
toBigDecimal(BigInteger bInteger)
To convert BigInteger to BigDecimal.BigInteger
toBigInteger(Double d)
To convert Double to BigInteger.BigInteger
toBigInteger(Float f)
To convert Float to BigInteger.BigInteger
toBigInteger(Number n)
To convert Number other than BigDecimal, Double and Float to BigInteger.BigInteger
toBigInteger(BigDecimal bDecimal)
To convert BigDecimal to BigInteger.
-
-
-
Method Detail
-
toBigDecimal
public BigDecimal toBigDecimal(BigInteger bInteger)
To convert BigInteger to BigDecimal.- Specified by:
toBigDecimal
in interfaceNumericConverter
- Parameters:
bInteger
- the BigInteger to be converted- Returns:
- converted BigDecimal
-
toBigDecimal
public BigDecimal toBigDecimal(Double d)
To convert Double to BigDecimal.- Specified by:
toBigDecimal
in interfaceNumericConverter
- Parameters:
d
- the Double to be converted- Returns:
- converted BigDecimal
-
toBigDecimal
public BigDecimal toBigDecimal(Float f)
To convert Float to BigDecimal.- Specified by:
toBigDecimal
in interfaceNumericConverter
- Parameters:
f
- the Float to be converted- Returns:
- converted BigDecimal
-
toBigDecimal
public BigDecimal toBigDecimal(Number n)
To convert Number other than BigInteger, Double and Float to BigDecimal.- Specified by:
toBigDecimal
in interfaceNumericConverter
- Parameters:
n
- the Number to be converted- Returns:
- converted BigDecimal
-
toBigInteger
public BigInteger toBigInteger(BigDecimal bDecimal)
To convert BigDecimal to BigInteger.- Specified by:
toBigInteger
in interfaceNumericConverter
- Parameters:
bDecimal
- the BigDecimal to be converted- Returns:
- converted BigInteger
-
toBigInteger
public BigInteger toBigInteger(Double d)
To convert Double to BigInteger.- Specified by:
toBigInteger
in interfaceNumericConverter
- Parameters:
d
- the Double to be converted- Returns:
- converted BigInteger
-
toBigInteger
public BigInteger toBigInteger(Float f)
To convert Float to BigInteger.- Specified by:
toBigInteger
in interfaceNumericConverter
- Parameters:
f
- the Float to be converted- Returns:
- converted BigInteger
-
toBigInteger
public BigInteger toBigInteger(Number n)
To convert Number other than BigDecimal, Double and Float to BigInteger.- Specified by:
toBigInteger
in interfaceNumericConverter
- Parameters:
n
- the Number to be converted- Returns:
- converted BigInteger
-
-