Package io.debezium.time
Class IsoTime
java.lang.Object
io.debezium.time.IsoTime
A utility for converting various Java time representations into a UTC ISO 8601 string representation
focusing on time (including fractional parts and offset from UTC), and for defining a Kafka Connect
Schema for time values in this format.
The ISO 8601 time format includes the time (including fractional parts) and offset from UTC, such as '10:15:30Z'.
- Author:
- Ismail Simsek
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DateTimeFormatterprivate static final Durationstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilderbuilder()Returns aSchemaBuilderfor aIsoTime.static org.apache.kafka.connect.data.Schemaschema()Returns a Schema for aIsoTimebut with all other default Schema settings.static StringtoIsoString(Object value, boolean acceptLargeValues)
-
Field Details
-
FORMATTER
-
SCHEMA_NAME
- See Also:
-
ONE_DAY
-
-
Constructor Details
-
IsoTime
private IsoTime()
-
-
Method Details
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()Returns aSchemaBuilderfor aIsoTime. The builder will create a schema that describes a field with the "io.debezium.time.IsoTime" as thenameandfor the literal type storing the time in UTC ISO 8601 format (e.g., "10:15:30Z").invalid reference
STRINGYou can use the resulting SchemaBuilder to set 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 aIsoTimebut with all other default Schema settings. The schema describes a field with the "io.debezium.time.IsoTime" as thenameandSTRINGfor the literal type storing the time in UTC ISO 8601 format (e.g., "10:15:30Z").- Returns:
- the schema
- See Also:
-
toIsoString
Converts aDuration,LocalTime,Date,Time, orTimestampobject to its UTC ISO 8601 string representation (e.g., "10:15:30Z").This method handles both
Durationvalues and time-related objects. ForDurationvalues, it ensures the resulting time is within the valid range (between 00:00:00 and 24:00:00 inclusive) by throwing anIllegalArgumentExceptionif the duration goes beyond this range and the `acceptLargeValues` parameter is set to false. For time-related objects, it converts them toLocalTimebefore formatting.- Parameters:
value- the time or duration value; may not be nullacceptLargeValues- whether to acceptDurationvalues exceeding the valid range (00:00:00 - 24:00:00)- Returns:
- the UTC ISO 8601 string representation of the time
- Throws:
IllegalArgumentException- if the value is not an instance of the acceptable types, or if aDurationvalue exceeds the valid range and `acceptLargeValues` is false.
-