Package io.debezium.time
Class NanoDuration
- java.lang.Object
-
- io.debezium.time.NanoDuration
-
public class NanoDuration extends Object
A utility representing a duration into a correspondingINT64number of nanosecond, and for defining a Kafka ConnectSchemafor duration values.
-
-
Field Summary
Fields Modifier and Type Field Description static StringSCHEMA_NAME
-
Constructor Summary
Constructors Modifier Constructor Description privateNanoDuration()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.kafka.connect.data.SchemaBuilderbuilder()Returns aSchemaBuilderfor aNanoDuration.static longdurationNanos(int years, int months, int days, int hours, int minutes, long seconds)Converts a number of time units to a duration in nanoseconds.static longdurationNanos(int years, int months, int days, int hours, int minutes, long seconds, long nanos)Converts a number of time units to a duration in nanoseconds.static org.apache.kafka.connect.data.Schemaschema()Returns a Schema for aNanoDurationbut with all other default Schema settings.
-
-
-
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 aNanoDuration. The resulting schema will describe a field with the "io.debezium.time.NanoDuration" as thenameandSchemaBuilder.int64()()} INT64} for the literal type storing the number of nanoseconds for that duration.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 aNanoDurationbut with all other default Schema settings. The schema describes a field with the "io.debezium.time.NanoDuration" as thenameandSchemaBuilder.int64()()} INT64} for the literal type storing the number of nanoseconds.- Returns:
- the schema
- See Also:
builder()
-
durationNanos
public static long durationNanos(int years, int months, int days, int hours, int minutes, long seconds, long nanos)Converts a number of time units to a duration in nanoseconds.- Parameters:
years- a number of yearsmonths- a number of monthsdays- a number of dayshours- a number of hoursminutes- a number of minutesseconds- a number of secondsnanos- a number of nanoseconds- Returns:
- Approximate representation of the given interval as a number of nanoseconds
-
durationNanos
public static long durationNanos(int years, int months, int days, int hours, int minutes, long seconds)Converts a number of time units to a duration in nanoseconds.- Parameters:
years- a number of yearsmonths- a number of monthsdays- a number of dayshours- a number of hoursminutes- a number of minutesseconds- a number of seconds- Returns:
- Approximate representation of the given interval as a number of nanoseconds
-
-