Top Description Fields Methods
com.amazon.ion

public Interface IonNumber

extends IonValue
Known Direct Subinterfaces
com.amazon.ion.IonDecimal, com.amazon.ion.IonFloat, com.amazon.ion.IonInt
Imports
java.math.BigDecimal

Common functionality of Ion int, decimal, and float types.

Warning

This interface should not be implemented or extended by code outside of this library.

Field Summary

Inherited from com.amazon.ion.IonValue:
EMPTY_ARRAY

Method Summary

Modifier and TypeMethod and Description
public BigDecimal

Returns:

the BigDecimal value, or null if this.isNullValue().
bigDecimalValue
()

Gets the value of this Ion number as a BigDecimal.

public boolean

Returns:

a checked condition whether this value is numeric.
isNumericValue
()

Determines whether this value is numeric.

Inherited from com.amazon.ion.IonValue:
acceptaddTypeAnnotationclearTypeAnnotationscloneequalsgetContainergetFieldIdgetFieldNamegetFieldNameSymbolgetSymbolTablegetSystemgetTypegetTypeAnnotationsgetTypeAnnotationSymbolshashCodehasTypeAnnotationisNullValueisReadOnlymakeReadOnlyremoveFromContainerremoveTypeAnnotationsetTypeAnnotationssetTypeAnnotationSymbolstopLevelValuetoPrettyStringtoStringtoStringwriteTo

Method Detail

bigDecimalValueback to summary
public BigDecimal bigDecimalValue()

Gets the value of this Ion number as a BigDecimal.

This method will throw an exception for non-null, non-numeric values. It's recommended to call isNumericValue() before calling this method.

Negative zero is supported by IonDecimal and IonFloat, but not by BigDecimal. If you need to distinguish positive and negative zero, you should call IonDecimal#decimalValue() or IonFloat#doubleValue() after casting to the appropriate type.

Returns:BigDecimal

the BigDecimal value, or null if this.isNullValue().

Exceptions
NumberFormatException:
if this value is nan, +inf, or -inf, because BigDecimal cannot represent those values.
isNumericValueback to summary
public boolean isNumericValue()

Determines whether this value is numeric. Returns true if this value is none of null, nan, +inf, and -inf, and false if it is any of them.

Returns:boolean

a checked condition whether this value is numeric.