DynamicBuilders.DynamicDuration


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


Interface defining a dynamic duration type.

Summary

Public functions

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

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

java-static DynamicBuilders.DynamicDuration

Creates a DynamicDuration from a byte array generated by toDynamicDurationByteArray.

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

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

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
getHoursPart()

Returns the number of hours part in the duration as a DynamicInt32.

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
getIntDaysPart()

Returns the total number of days in a duration as a DynamicInt32.

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
getMinutesPart()

Returns the number of minutes part in the duration as a DynamicInt32.

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
getSecondsPart()

Returns the number of seconds part in the duration as a DynamicInt32.

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

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

ByteArray<Byte>

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

Int

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

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

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

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
toIntDays()

Returns the total number of days in a DynamicDuration as a DynamicInt32.

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
toIntHours()

Returns the total number of hours in a DynamicDuration as a DynamicInt32.

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
toIntMinutes()

Returns the total number of minutes in a DynamicDuration as a .

DynamicBuilders.DynamicInt32
@RequiresSchemaVersion(major = 1, minor = 200)
toIntSeconds()

Returns the total number of seconds in a DynamicDuration as a .

java-static DynamicBuilders.DynamicDuration
@RequiresSchemaVersion(major = 1, minor = 200)
withSecondsPrecision(duration: Duration)

Creates a constant-valued DynamicDuration from a Duration.

Public functions

from

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

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

Parameters
dynamicDataKey: DynamicDataKey<DynamicBuilders.DynamicDuration!>

The source key to a DynamicDataValue with an value.

fromByteArray

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

Creates a DynamicDuration from a byte array generated by toDynamicDurationByteArray.

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

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

Throws
java.lang.IllegalArgumentException

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

getHoursPart

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun getHoursPart(): DynamicBuilders.DynamicInt32

Returns the number of hours part in the duration as a DynamicInt32. This represents the absolute value of remaining hours when dividing total hours by hours in a day (24 hours); As an example, the following is equal to DynamicInt32.constant(10)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getHoursPart();
Returns
DynamicBuilders.DynamicInt32

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

getIntDaysPart

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun getIntDaysPart(): DynamicBuilders.DynamicInt32

Returns the total number of days in a duration as a DynamicInt32. This represents the absolute value of the total number of days in the duration based on the 24 hours day definition. The fraction part of the result will be truncated; As an example, the following is equal to DynamicInt32.constant(1)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getIntDaysPart();
Returns
DynamicBuilders.DynamicInt32

a new instance of DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

getMinutesPart

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun getMinutesPart(): DynamicBuilders.DynamicInt32

Returns the number of minutes part in the duration as a DynamicInt32. This represents the absolute value of remaining minutes when dividing total minutes by minutes in an hour (60 minutes). As an example, the following is equal to DynamicInt32.constant(17)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getMinutesPart();
Returns
DynamicBuilders.DynamicInt32

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

getSecondsPart

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun getSecondsPart(): DynamicBuilders.DynamicInt32

Returns the number of seconds part in the duration as a DynamicInt32. This represents the absolute value of remaining seconds when dividing total seconds by seconds in a minute (60 seconds); As an example, the following is equal to DynamicInt32.constant(36)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .getSecondsPart();
Returns
DynamicBuilders.DynamicInt32

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

onCondition

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

Bind the value of this DynamicDuration 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.

toDynamicDurationByteArray

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

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

toDynamicDurationByteArray

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

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

Throws
java.lang.IllegalArgumentException

if the byte array is too small

toDynamicDurationByteArray

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

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

Throws
java.lang.IllegalArgumentException

if the byte array is too small

toIntDays

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntDays(): DynamicBuilders.DynamicInt32

Returns the total number of days in a DynamicDuration as a DynamicInt32. The fraction part of the result will be truncated. This is based on the standard definition of a day as 24 hours. As an example, the following is equal to DynamicInt32.constant(1)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntDays();
Returns
DynamicBuilders.DynamicInt32

a new instance of DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

toIntHours

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntHours(): DynamicBuilders.DynamicInt32

Returns the total number of hours in a DynamicDuration as a DynamicInt32. The fraction part of the result will be truncated. As an example, the following is equal to DynamicInt32.constant(34)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntHours();
Returns
DynamicBuilders.DynamicInt32

a new instance of DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

toIntMinutes

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntMinutes(): DynamicBuilders.DynamicInt32

Returns the total number of minutes in a DynamicDuration as a . The fraction part of the result will be truncated. As an example, the following is equal to DynamicInt32.constant(2057)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntMinutes();
Returns
DynamicBuilders.DynamicInt32

a new instance of DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

toIntSeconds

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun toIntSeconds(): DynamicBuilders.DynamicInt32

Returns the total number of seconds in a DynamicDuration as a . As an example, the following is equal to DynamicInt32.constant(123456)

  DynamicInstant.withSecondsPrecision(Instant.EPOCH)
     .durationUntil(DynamicInstant.withSecondsPrecision(Instant.ofEpochSecond(123456L)))
     .toIntSeconds();
Returns
DynamicBuilders.DynamicInt32

a new instance of DynamicInt32 containing the result of the operation. Integer overflow can occur if the result of the operation is larger than MAX_VALUE.

withSecondsPrecision

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun withSecondsPrecision(duration: Duration): DynamicBuilders.DynamicDuration

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