Class NanoDuration


  • public class NanoDuration
    extends Object
    A utility representing a duration into a corresponding INT64 number of nanosecond, and for defining a Kafka Connect Schema for duration values.
    • Constructor Detail

      • NanoDuration

        private NanoDuration()
    • Method Detail

      • builder

        public static org.apache.kafka.connect.data.SchemaBuilder builder()
        Returns a SchemaBuilder for a NanoDuration. The resulting schema will describe a field with the "io.debezium.time.NanoDuration" as the name and SchemaBuilder.int64() ()} INT64} for the literal type storing the number of nanoseconds for that duration.

        You can use the resulting SchemaBuilder to set or override additional schema settings such as required/optional, default value, and documentation.

        Returns:
        the schema builder
      • schema

        public static org.apache.kafka.connect.data.Schema schema()
        Returns a Schema for a NanoDuration but with all other default Schema settings. The schema describes a field with the "io.debezium.time.NanoDuration" as the name and SchemaBuilder.int64() ()} INT64} for the literal type storing the number of nanoseconds.
        Returns:
        the schema
        See Also:
        builder()
      • durationNanos

        public static long durationNanos​(int years,
                                         int months,
                                         int days,
                                         int hours,
                                         int minutes,
                                         long seconds,
                                         long nanos)
        Converts a number of time units to a duration in nanoseconds.
        Parameters:
        years - a number of years
        months - a number of months
        days - a number of days
        hours - a number of hours
        minutes - a number of minutes
        seconds - a number of seconds
        nanos - a number of nanoseconds
        Returns:
        Approximate representation of the given interval as a number of nanoseconds
      • durationNanos

        public static long durationNanos​(int years,
                                         int months,
                                         int days,
                                         int hours,
                                         int minutes,
                                         long seconds)
        Converts a number of time units to a duration in nanoseconds.
        Parameters:
        years - a number of years
        months - a number of months
        days - a number of days
        hours - a number of hours
        minutes - a number of minutes
        seconds - a number of seconds
        Returns:
        Approximate representation of the given interval as a number of nanoseconds