Package io.debezium.time
Class Date
- java.lang.Object
-
- io.debezium.time.Date
-
public class Date extends Object
A utility for converting various Java temporal object representations into the signedINT32number of days since January 1, 1970, at 00:00:00UTC, and for defining a Kafka ConnectSchemafor date values with no time or timezone information.- Author:
- Randall Hauch
- See Also:
Timestamp,ZonedTimestamp
-
-
Field Summary
Fields Modifier and Type Field Description static StringSCHEMA_NAME
-
Constructor Summary
Constructors Modifier Constructor Description privateDate()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.kafka.connect.data.SchemaBuilderbuilder()Returns aSchemaBuilderfor aDate.static org.apache.kafka.connect.data.Schemaschema()Returns a Schema for aDatebut with all other default Schema settings.static inttoEpochDay(Object value, TemporalAdjuster adjuster)
-
-
-
Field Detail
-
SCHEMA_NAME
public static final String SCHEMA_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()
Returns aSchemaBuilderfor aDate. The builder will create a schema that describes a field with the "io.debezium.time.Date" as thenameandINT32for the literal type storing the number of days since January 1, 1970, at 00:00:00Z.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 aDatebut with all other default Schema settings. The schema describes a field with the "io.debezium.time.Date" as thenameandINT32for the literal type storing the number of days since January 1, 1970, at 00:00:00Z.- Returns:
- the schema
- See Also:
builder()
-
toEpochDay
public static int toEpochDay(Object value, TemporalAdjuster adjuster)
Get the number of epoch days of the givenLocalDateTime,LocalDate,LocalTime,Date,Date,Time, orTimestamp, ignoring any time portions of the supplied value.- 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 number of days past epoch
- Throws:
IllegalArgumentException- if the value is not an instance of the acceptable types
-
-