DynamicBuilders.DynamicInstant


@RequiresSchemaVersion(major = 1, minor = 200)
interface DynamicBuilders.DynamicInstant : DynamicBuilders.DynamicType


Interface defining a dynamic time instant type.

DynamicInstant precision is seconds. Thus, any time or duration operation will operate on that precision level.

Summary

Public functions

DynamicBuilders.DynamicDuration

Returns duration between the two DynamicInstant instances as a .

java-static DynamicBuilders.DynamicInstant
@RequiresSchemaVersion(major = 1, minor = 300)
from(dynamicDataKey: DynamicDataKey<DynamicBuilders.DynamicInstant!>)

Creates a DynamicInstant that is bound to the value of an item of the State.

java-static DynamicBuilders.DynamicInstant

Creates a DynamicInstant from a byte array generated by toDynamicInstantByteArray.

java-static DynamicBuilders.DynamicInstant
fromByteArray(byteArray: ByteArray, offset: Int, length: Int)

Creates a DynamicInstant from the provided byte array at the provided offset and length, that was generated by one of the toDynamicInstantByteArray overloads.

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getDayOfMonth(zoneId: ZoneId)

Returns the day-of-month field from 1 to 31 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(1):

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getDayOfWeek(zoneId: ZoneId)

Returns the day-of-week field going from MONDAY (1) to SUNDAY (7) following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(4):

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getHour(zoneId: ZoneId)

Returns the hour-of-day field from 0 to 23 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(3):

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getMinute(zoneId: ZoneId)

Returns the minute-of-hour field from 0 to 59 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(20):

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getMonth(zoneId: ZoneId)

Returns the month-of-year field from 1 to 12 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(1):

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getSecond(zoneId: ZoneId)

Returns the second-of-minute field from 0 to 59 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(10):

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getYear(zoneId: ZoneId)

Returns the year field following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(1970):

java-static ConditionScopes.ConditionScope<DynamicBuilders.DynamicInstant!, Instant!>
@RequiresSchemaVersion(major = 1, minor = 200)
onCondition(condition: DynamicBuilders.DynamicBool)

Bind the value of this DynamicInstant to the result of a conditional expression.

java-static DynamicBuilders.DynamicInstant

Creates a DynamicInstant that updates its value periodically from the system time.

ByteArray<Byte>

Serializes the DynamicInstant into a new byte array that can later be used with fromByteArray.

Int

Serializes the DynamicInstant into the provided byte array, returning the amount of bytes written, that can later be used with DynamicInstant.fromByteArray( byteArray, 0, bytesWritten).

Int
toDynamicInstantByteArray(byteArray: ByteArray, offset: Int, length: Int)

Serializes the DynamicInstant into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with DynamicInstant.fromByteArray(byteArray, offset, bytesWritten).

java-static DynamicBuilders.DynamicInstant
@RequiresSchemaVersion(major = 1, minor = 200)
withSecondsPrecision(instant: Instant)

Creates a constant-valued DynamicInstant from an Instant.

Public functions

durationUntil

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun durationUntil(to: DynamicBuilders.DynamicInstant): DynamicBuilders.DynamicDuration

Returns duration between the two DynamicInstant instances as a . The resulted duration is inclusive of the start instant and exclusive of the end; As an example, the following expression yields a duration object representing 10 seconds:

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(10L))
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(20L)));
Returns
DynamicBuilders.DynamicDuration

a new instance of DynamicDuration containing the result of the operation.

from

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
java-static fun from(dynamicDataKey: DynamicDataKey<DynamicBuilders.DynamicInstant!>): DynamicBuilders.DynamicInstant

Creates a DynamicInstant that is bound to the value of an item of the State.

Parameters
dynamicDataKey: DynamicDataKey<DynamicBuilders.DynamicInstant!>

The source key to a DynamicDataValue with an value.

fromByteArray

Added in 1.0.0
java-static fun fromByteArray(byteArray: ByteArray): DynamicBuilders.DynamicInstant

Creates a DynamicInstant from a byte array generated by toDynamicInstantByteArray.

Throws
java.lang.IllegalArgumentException

if the byte array does not contain a valid serialization

fromByteArray

Added in 1.0.0
java-static fun fromByteArray(byteArray: ByteArray, offset: Int, length: Int): DynamicBuilders.DynamicInstant

Creates a DynamicInstant from the provided byte array at the provided offset and length, that was generated by one of the toDynamicInstantByteArray overloads.

Throws
java.lang.IllegalArgumentException

if the byte array does not contain a valid serialization in the provided offset and length

getDayOfMonth

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun getDayOfMonth(zoneId: ZoneId): DynamicBuilders.DynamicInt32

Returns the day-of-month field from 1 to 31 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(1):

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(8410))
     .getDayOfMonth(ZoneId.of("Europe/London"));

getDayOfWeek

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun getDayOfWeek(zoneId: ZoneId): DynamicBuilders.DynamicInt32

Returns the day-of-week field going from MONDAY (1) to SUNDAY (7) following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(4):

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(8410))
     .getDayOfWeek(ZoneId.of("Europe/London"));

getHour

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun getHour(zoneId: ZoneId): DynamicBuilders.DynamicInt32

Returns the hour-of-day field from 0 to 23 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(3):

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(8410))
     .getHour(ZoneId.of("Europe/London"));

getMinute

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun getMinute(zoneId: ZoneId): DynamicBuilders.DynamicInt32

Returns the minute-of-hour field from 0 to 59 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(20):

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(8410))
     .getMinute(ZoneId.of("Europe/London"));

getMonth

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun getMonth(zoneId: ZoneId): DynamicBuilders.DynamicInt32

Returns the month-of-year field from 1 to 12 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(1):

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(8410))
     .getMonth(ZoneId.of("Europe/London"));

getSecond

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun getSecond(zoneId: ZoneId): DynamicBuilders.DynamicInt32

Returns the second-of-minute field from 0 to 59 following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(10):

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(8410))
     .getSecond(ZoneId.of("Europe/London"));

getYear

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
fun getYear(zoneId: ZoneId): DynamicBuilders.DynamicInt32

Returns the year field following the ISO-8601 calendar system; As an example, the following is equal to DynamicInt32.constant(1970):

  DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(8410))
     .getYear(ZoneId.of("Europe/London"));

onCondition

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun onCondition(condition: DynamicBuilders.DynamicBool): ConditionScopes.ConditionScope<DynamicBuilders.DynamicInstant!, Instant!>

Bind the value of this DynamicInstant to the result of a conditional expression. This will use the value given in either use or elseUse depending on the value yielded from condition.

platformTimeWithSecondsPrecision

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun platformTimeWithSecondsPrecision(): DynamicBuilders.DynamicInstant

Creates a DynamicInstant that updates its value periodically from the system time.

toDynamicInstantByteArray

Added in 1.0.0
fun toDynamicInstantByteArray(): ByteArray<Byte>

Serializes the DynamicInstant into a new byte array that can later be used with fromByteArray.

toDynamicInstantByteArray

Added in 1.0.0
fun toDynamicInstantByteArray(byteArray: ByteArray): Int

Serializes the DynamicInstant into the provided byte array, returning the amount of bytes written, that can later be used with DynamicInstant.fromByteArray( byteArray, 0, bytesWritten).

Throws
java.lang.IllegalArgumentException

if the byte array is too small

toDynamicInstantByteArray

Added in 1.0.0
fun toDynamicInstantByteArray(byteArray: ByteArray, offset: Int, length: Int): Int

Serializes the DynamicInstant into the provided byte array, returning the amount of bytes written, limited by the provided offset and length, that can later be used with DynamicInstant.fromByteArray(byteArray, offset, bytesWritten).

Throws
java.lang.IllegalArgumentException

if the byte array is too small

withSecondsPrecision

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun withSecondsPrecision(instant: Instant): DynamicBuilders.DynamicInstant

Creates a constant-valued DynamicInstant from an Instant. If precision is greater than seconds, then any excess precision information will be dropped.