Class NanoDuration

java.lang.Object
io.debezium.time.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.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.kafka.connect.data.SchemaBuilder
    Returns a SchemaBuilder for a NanoDuration.
    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.
    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.
    static org.apache.kafka.connect.data.Schema
    Returns a Schema for a NanoDuration but with all other default Schema settings.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • NanoDuration

      private NanoDuration()
  • Method Details

    • 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:
    • 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