Interface IonDecimal

All Superinterfaces:
Cloneable, IonNumber, IonValue

public interface IonDecimal extends IonNumber
An Ion decimal value.

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

  • Method Details

    • floatValue

      float floatValue() throws NullValueException
      Gets the value of this Ion decimal as a Java float value.
      Returns:
      the float value.
      Throws:
      NullValueException - if this.isNullValue().
    • doubleValue

      double doubleValue() throws NullValueException
      Gets the value of this Ion decimal as a Java double value.
      Returns:
      the double value.
      Throws:
      NullValueException - if this.isNullValue().
    • bigDecimalValue

      BigDecimal bigDecimalValue()
      Gets the value of this Ion decimal as a BigDecimal. If you need negative zeros, use decimalValue().
      Specified by:
      bigDecimalValue in interface IonNumber
      Returns:
      the BigDecimal value, or null if this.isNullValue().
      See Also:
    • decimalValue

      Decimal decimalValue()
      Gets the value of this Ion decimal as a Decimal, which extends BigDecimal with support for negative zeros.
      Returns:
      the Decimal value, or null if this.isNullValue().
      See Also:
    • setValue

      void setValue(long value)
      Sets the value of this element.
    • setValue

      void setValue(float value)
      Sets the value of this element. This method behaves like BigDecimal.valueOf(double) in that it uses the double's canonical string representation provided by Double.toString(double)}.
      See Also:
    • setValue

      void setValue(double value)
      Sets the value of this element. This method behaves like BigDecimal.valueOf(double) in that it uses the double's canonical string representation provided by Double.toString(double)}.
      See Also:
    • setValue

      void setValue(BigDecimal value)
      Sets the value of this element. To set a negative zero value, pass an Decimal.
      Parameters:
      value - the new value of this decimal; may be null to make this null.decimal.
    • clone

      Description copied from interface: IonValue
      Creates a copy of this value and all of its children. The cloned value may use the same shared symbol tables, but it will have an independent local symbol table if necessary. The cloned value will be modifiable regardless of whether this instance IonValue.isReadOnly().

      The cloned value will be created in the context of the same ValueFactory as this instance; if you want a copy using a different factory, then use ValueFactory.clone(IonValue) instead.

      Specified by:
      clone in interface IonValue
      Throws:
      UnknownSymbolException - if any part of this value has unknown text but known Sid for its field name, annotation or symbol.