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 BigDecimaltoBigDecimal(Double d)To convert Double to BigDecimal.BigDecimaltoBigDecimal(Float f)To convert Float to BigDecimal.BigDecimaltoBigDecimal(Number n)To convert Number other than BigInteger, Double and Float to BigDecimal.BigDecimaltoBigDecimal(BigInteger bInteger)To convert BigInteger to BigDecimal.BigIntegertoBigInteger(Double d)To convert Double to BigInteger.BigIntegertoBigInteger(Float f)To convert Float to BigInteger.BigIntegertoBigInteger(Number n)To convert Number other than BigDecimal, Double and Float to BigInteger.BigIntegertoBigInteger(BigDecimal bDecimal)To convert BigDecimal to BigInteger.
-
-
-
Method Detail
-
toBigDecimal
public BigDecimal toBigDecimal(BigInteger bInteger)
To convert BigInteger to BigDecimal.- Specified by:
toBigDecimalin interfaceNumericConverter- Parameters:
bInteger- the BigInteger to be converted- Returns:
- converted BigDecimal
-
toBigDecimal
public BigDecimal toBigDecimal(Double d)
To convert Double to BigDecimal.- Specified by:
toBigDecimalin interfaceNumericConverter- Parameters:
d- the Double to be converted- Returns:
- converted BigDecimal
-
toBigDecimal
public BigDecimal toBigDecimal(Float f)
To convert Float to BigDecimal.- Specified by:
toBigDecimalin 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:
toBigDecimalin interfaceNumericConverter- Parameters:
n- the Number to be converted- Returns:
- converted BigDecimal
-
toBigInteger
public BigInteger toBigInteger(BigDecimal bDecimal)
To convert BigDecimal to BigInteger.- Specified by:
toBigIntegerin interfaceNumericConverter- Parameters:
bDecimal- the BigDecimal to be converted- Returns:
- converted BigInteger
-
toBigInteger
public BigInteger toBigInteger(Double d)
To convert Double to BigInteger.- Specified by:
toBigIntegerin interfaceNumericConverter- Parameters:
d- the Double to be converted- Returns:
- converted BigInteger
-
toBigInteger
public BigInteger toBigInteger(Float f)
To convert Float to BigInteger.- Specified by:
toBigIntegerin 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:
toBigIntegerin interfaceNumericConverter- Parameters:
n- the Number to be converted- Returns:
- converted BigInteger
-
-