Class IsoDate

java.lang.Object
io.debezium.time.IsoDate

public class IsoDate extends Object
A utility for converting various Java temporal object representations into a UTC ISO 8601 string representation, specifically focusing on dates (without time or timezone information). Additionally, it defines a Kafka Connect Schema for representing dates in this format.
Author:
Ismail Simsek
See Also:
  • Field Details

  • Constructor Details

    • IsoDate

      private IsoDate()
  • Method Details

    • builder

      public static org.apache.kafka.connect.data.SchemaBuilder builder()
      Returns a SchemaBuilder for a IsoDate. The builder will create a schema that describes a field with the "io.debezium.time.IsoDate" as the name and STRING for the literal type storing the date in UTC ISO 8601 format (e.g., "2023-11-21").

      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 IsoDate but with all other default Schema settings. The schema describes a field with the "io.debezium.time.IsoDate" as the name and STRING for the literal type storing the date in UTC ISO 8601 format (e.g., "2023-11-21").
      Returns:
      the schema
      See Also:
    • toIsoString

      public static String toIsoString(Object value, TemporalAdjuster adjuster)
      Converts a LocalDateTime, LocalDate, LocalTime, Date, Date, Time, or Timestamp to its UTC ISO 8601 string representation (e.g., "2023-11-21").

      This method ignores time components of the input value. If an adjuster is provided, it's used to adjust the LocalDate before converting it to the string representation.

      Parameters:
      value - the local or SQL date, time, or timestamp value; may not be null
      adjuster - the optional component that adjusts the local date value before obtaining the string representation; may be null if no adjustment is necessary
      Returns:
      the UTC ISO 8601 string representation of the date
      Throws:
      IllegalArgumentException - if the value is not an instance of the acceptable types