Class BigDecimalWrapper

java.lang.Object
io.deephaven.web.client.api.BigDecimalWrapper

@JsType(namespace="dh") public class BigDecimalWrapper extends Object
Wrap BigDecimal values for use in JS. Provides text formatting for display and access to the underlying value.
  • Constructor Details

    • BigDecimalWrapper

      @JsIgnore public BigDecimalWrapper(@Nonnull BigDecimal value)
  • Method Details

    • ofString

      public static BigDecimalWrapper ofString(String value)
      Creates a wrapper from a decimal string. Strings may optionally start with +/-, must have a decimal value, and may end with e/E followed by an exponent.
      Parameters:
      value - A string representation of a decimal number.
      Returns:
      A wrapper for the parsed value.
    • getWrapped

      @JsIgnore public BigDecimal getWrapped()
    • asNumber

      public double asNumber()
      Returns the wrapped value as a number.
      Returns:
      The BigDecimal value converted to a JS Number.
    • valueOf

      public String valueOf()
      Returns the string representation of this value.

      Provided to match JavaScript's valueOf convention.

      Returns:
      The string form of this value.
    • toString

      public String toString()
      Returns the string representation of the wrapped BigDecimal.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Compares this wrapper to another object.
      Overrides:
      equals in class Object
      Parameters:
      o - The object to compare.
      Returns:
      true if o is a BigDecimalWrapper with an equal wrapped value.
    • hashCode

      public int hashCode()
      Returns a hash code based on the wrapped value.
      Overrides:
      hashCode in class Object