DynamicBuilders.DynamicInstant


@RequiresSchemaVersion(major = 1, minor = 200)
public interface DynamicBuilders.DynamicInstant extends 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 methods

default @NonNull DynamicBuilders.DynamicDuration

Returns duration between the two DynamicInstant instances as a .

default static @NonNull DynamicBuilders.DynamicInstant
@RequiresSchemaVersion(major = 1, minor = 300)
from(
    @NonNull DynamicDataKey<DynamicBuilders.DynamicInstant> dynamicDataKey
)

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

default static @NonNull DynamicBuilders.DynamicInstant
fromByteArray(@NonNull byte[] byteArray)

Creates a DynamicInstant from a byte array generated by toDynamicInstantByteArray.

default static @NonNull DynamicBuilders.DynamicInstant
fromByteArray(@NonNull byte[] byteArray, int offset, int length)

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

default @NonNull DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getDayOfMonth(@NonNull 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):

default @NonNull DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getDayOfWeek(@NonNull 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):

default @NonNull DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getHour(@NonNull 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):

default @NonNull DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getMinute(@NonNull 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):

default @NonNull DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getMonth(@NonNull 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):

default @NonNull DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 300)
getSecond(@NonNull 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):

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

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

default static @NonNull ConditionScopes.ConditionScope<DynamicBuilders.DynamicInstantInstant>
@RequiresSchemaVersion(major = 1, minor = 200)
onCondition(@NonNull DynamicBuilders.DynamicBool condition)

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

default static @NonNull DynamicBuilders.DynamicInstant

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

default @NonNull byte[]

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

default 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).

default int
toDynamicInstantByteArray(
    @NonNull byte[] byteArray,
    int offset,
    int length
)

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).

default static @NonNull DynamicBuilders.DynamicInstant
@RequiresSchemaVersion(major = 1, minor = 200)
withSecondsPrecision(@NonNull Instant instant)

Creates a constant-valued DynamicInstant from an Instant.

Public methods

durationUntil

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

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
@NonNull DynamicBuilders.DynamicDuration

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

from

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default static @NonNull DynamicBuilders.DynamicInstant from(
    @NonNull DynamicDataKey<DynamicBuilders.DynamicInstant> dynamicDataKey
)

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

Parameters
@NonNull DynamicDataKey<DynamicBuilders.DynamicInstant> dynamicDataKey

The source key to a DynamicDataValue with an value.

fromByteArray

Added in 1.0.0
default static @NonNull DynamicBuilders.DynamicInstant fromByteArray(@NonNull byte[] byteArray)

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
default static @NonNull DynamicBuilders.DynamicInstant fromByteArray(@NonNull byte[] byteArray, int offset, int length)

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)
default @NonNull DynamicBuilders.DynamicInt32 getDayOfMonth(@NonNull 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):

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

getDayOfWeek

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default @NonNull DynamicBuilders.DynamicInt32 getDayOfWeek(@NonNull 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):

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

getHour

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default @NonNull DynamicBuilders.DynamicInt32 getHour(@NonNull 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):

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

getMinute

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default @NonNull DynamicBuilders.DynamicInt32 getMinute(@NonNull 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):

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

getMonth

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default @NonNull DynamicBuilders.DynamicInt32 getMonth(@NonNull 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):

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

getSecond

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default @NonNull DynamicBuilders.DynamicInt32 getSecond(@NonNull 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):

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

getYear

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

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)
default static @NonNull ConditionScopes.ConditionScope<DynamicBuilders.DynamicInstantInstantonCondition(@NonNull DynamicBuilders.DynamicBool condition)

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)
default static @NonNull DynamicBuilders.DynamicInstant platformTimeWithSecondsPrecision()

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

toDynamicInstantByteArray

Added in 1.0.0
default @NonNull byte[] toDynamicInstantByteArray()

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

toDynamicInstantByteArray

Added in 1.0.0
default int toDynamicInstantByteArray(@NonNull byte[] byteArray)

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
default int toDynamicInstantByteArray(
    @NonNull byte[] byteArray,
    int offset,
    int length
)

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)
default static @NonNull DynamicBuilders.DynamicInstant withSecondsPrecision(@NonNull Instant instant)

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