Class DecimalUtils


  • public final class DecimalUtils
    extends java.lang.Object
    Utilities to aid in the translation of decimal types to/from multiple parts.
    Since:
    2.2
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static <T> T extractSecondsAndNanos​(java.math.BigDecimal seconds, java.util.function.BiFunction<java.lang.Long,​java.lang.Integer,​T> convert)
      Deprecated.
      static <T> T extractSecondsAndNanos​(java.math.BigDecimal seconds, java.util.function.BiFunction<java.lang.Long,​java.lang.Integer,​T> convert, boolean negativeAdjustment)
      Extracts the seconds and nanoseconds component of seconds as long and int values, passing them to the given converter.
      static java.math.BigDecimal toBigDecimal​(long seconds, int nanoseconds)
      Factory method for constructing BigDecimal out of second, nano-second components.
      static java.lang.String toDecimal​(long seconds, int nanoseconds)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toDecimal

        public static java.lang.String toDecimal​(long seconds,
                                                 int nanoseconds)
      • toBigDecimal

        public static java.math.BigDecimal toBigDecimal​(long seconds,
                                                        int nanoseconds)
        Factory method for constructing BigDecimal out of second, nano-second components.
        Since:
        2.8
      • extractSecondsAndNanos

        @Deprecated
        public static <T> T extractSecondsAndNanos​(java.math.BigDecimal seconds,
                                                   java.util.function.BiFunction<java.lang.Long,​java.lang.Integer,​T> convert)
        Deprecated.
        Extracts the seconds and nanoseconds component of seconds as long and int values, passing them to the given converter. The implementation avoids latency issues present on some JRE releases.
        Since:
        2.9.8
      • extractSecondsAndNanos

        public static <T> T extractSecondsAndNanos​(java.math.BigDecimal seconds,
                                                   java.util.function.BiFunction<java.lang.Long,​java.lang.Integer,​T> convert,
                                                   boolean negativeAdjustment)
        Extracts the seconds and nanoseconds component of seconds as long and int values, passing them to the given converter. The implementation avoids latency issues present on some JRE releases.
        Since:
        2.19