Package io.debezium.time
Class IsoDate
java.lang.Object
io.debezium.time.IsoDate
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilderbuilder()Returns aSchemaBuilderfor aIsoDate.static org.apache.kafka.connect.data.Schemaschema()Returns a Schema for aIsoDatebut with all other default Schema settings.static StringtoIsoString(Object value, TemporalAdjuster adjuster)
-
Field Details
-
FORMATTER
-
SCHEMA_NAME
- See Also:
-
-
Constructor Details
-
IsoDate
private IsoDate()
-
-
Method Details
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()Returns aSchemaBuilderfor aIsoDate. The builder will create a schema that describes a field with the "io.debezium.time.IsoDate" as thenameandSTRINGfor 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 aIsoDatebut with all other default Schema settings. The schema describes a field with the "io.debezium.time.IsoDate" as thenameandSTRINGfor the literal type storing the date in UTC ISO 8601 format (e.g., "2023-11-21").- Returns:
- the schema
- See Also:
-
toIsoString
Converts aLocalDateTime,LocalDate,LocalTime,Date,Date,Time, orTimestampto 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
LocalDatebefore converting it to the string representation.- Parameters:
value- the local or SQL date, time, or timestamp value; may not be nulladjuster- 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
-