Class Time

java.lang.Object
io.debezium.time.Time

public class Time extends Object
A utility for converting various Java time representations into the INT32 number of milliseconds since midnight, and for defining a Kafka Connect Schema for time values with no date or timezone information.
Author:
Randall Hauch
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Duration
     
    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 Time.
    static org.apache.kafka.connect.data.Schema
    Returns a Schema for a Time but with all other default Schema settings.
    static int
    toMilliOfDay(Object value, boolean acceptLargeValues)
    Get the number of milliseconds past midnight of the given Duration.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • Time

      private Time()
  • Method Details

    • builder

      public static org.apache.kafka.connect.data.SchemaBuilder builder()
      Returns a SchemaBuilder for a Time. The resulting schema will describe a field with the "io.debezium.time.Time" as the name and INT32 for the literal type storing the number of milliseconds past midnight.

      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 Time but with all other default Schema settings. The schema describes a field with the "io.debezium.time.Time" as the name and INT32 for the literal type storing the number of milliseconds past midnight.
      Returns:
      the schema
      See Also:
    • toMilliOfDay

      public static int toMilliOfDay(Object value, boolean acceptLargeValues)
      Get the number of milliseconds past midnight of the given Duration.
      Parameters:
      value - the duration value; may not be null
      acceptLargeValues - whether to accept values less than 00:00:00 and larger than 24:00:00 or not
      Returns:
      the milliseconds past midnight
      Throws:
      IllegalArgumentException - if the value is not an instance of the acceptable types or it is out of the supported range