Package io.debezium.time
Class MicroTimestamp
java.lang.Object
io.debezium.time.MicroTimestamp
A utility for converting various Java time representations into the signed
INT64
number of
microseconds past epoch, and for defining a Kafka Connect Schema
for timestamp values with no timezone
information.- Author:
- Randall Hauch
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilder
builder()
Returns aSchemaBuilder
for aMicroTimestamp
.static org.apache.kafka.connect.data.Schema
schema()
Returns a Schema for aMicroTimestamp
but with all other default Schema settings.static long
toEpochMicros
(Object value, TemporalAdjuster adjuster)
-
Field Details
-
SCHEMA_NAME
- See Also:
-
-
Constructor Details
-
MicroTimestamp
private MicroTimestamp()
-
-
Method Details
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()Returns aSchemaBuilder
for aMicroTimestamp
. The resulting schema will describe a field with the "io.debezium.time.MicroTimestamp" as thename
andINT64
for the literal type storing the number of microseconds 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 aMicroTimestamp
but with all other default Schema settings. The schema describes a field with the "io.debezium.time.MicroTimestamp" as thename
andINT64
for the literal type storing the number of microseconds past midnight.- Returns:
- the schema
- See Also:
-
toEpochMicros
Get the number of microseconds past epoch of the givenLocalDateTime
,LocalDate
,LocalTime
,Date
,Date
,Time
, orTimestamp
.- 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 epoch day; may be null if no adjustment is necessary- Returns:
- the epoch microseconds
- Throws:
IllegalArgumentException
- if the value is not an instance of the acceptable types
-