DynamicDataBuilders.DynamicDataValue


@RequiresSchemaVersion(major = 1, minor = 200)
public interface DynamicDataBuilders.DynamicDataValue<T extends DynamicBuilders.DynamicType>


Interface defining a dynamic data value.

Summary

Public methods

default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicBool>
@RequiresSchemaVersion(major = 1, minor = 200)
fromBool(boolean constant)

Creates a boolean DynamicDataValue.

default static @NonNull DynamicDataBuilders.DynamicDataValue<Object>
fromByteArray(@NonNull byte[] byteArray)

Creates a DynamicDataValue from a byte array generated by toDynamicDataValueByteArray.

default static @NonNull DynamicDataBuilders.DynamicDataValue<Object>
fromByteArray(@NonNull byte[] byteArray, int offset, int length)

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

default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicColor>
@RequiresSchemaVersion(major = 1, minor = 200)
fromColor(@ColorInt int constant)

Creates a color DynamicDataValue.

default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicDuration>
@RequiresSchemaVersion(major = 1, minor = 300)
fromDuration(@NonNull Duration constant)

Creates a DurationDynamicDataValue.

default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicFloat>
@RequiresSchemaVersion(major = 1, minor = 200)
fromFloat(float constant)

Creates a float DynamicDataValue.

default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicInstant>
@RequiresSchemaVersion(major = 1, minor = 300)
fromInstant(@NonNull Instant constant)

Creates an InstantDynamicDataValue.

default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicInt32>
@RequiresSchemaVersion(major = 1, minor = 200)
fromInt(int constant)

Creates a int DynamicDataValue.

default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicString>
@RequiresSchemaVersion(major = 1, minor = 200)
fromString(@NonNull String constant)

Creates a string DynamicDataValue.

default boolean

Returns the boolean value stored in this DynamicDataValue.

default @ColorInt int

Returns the color value stored in this DynamicDataValue.

default @NonNull Duration

Returns the Duration value stored in this DynamicDataValue.

default float

Returns the float value stored in this DynamicDataValue.

default @NonNull Instant

Returns the Instant value stored in this DynamicDataValue.

default int

Returns the int value stored in this DynamicDataValue.

default @NonNull String

Returns the String value stored in this DynamicDataValue.

default boolean

Returns true if the DynamicDataValue contains a boolean value.

default boolean

Returns true if the DynamicDataValue contains a color value.

default boolean

Returns true if the DynamicDataValue contains an Duration value.

default boolean

Returns true if the DynamicDataValue contains a float value.

default boolean

Returns true if the DynamicDataValue contains an Instant value.

default boolean

Returns true if the DynamicDataValue contains an int value.

default boolean

Returns true if the DynamicDataValue contains a String value.

default @NonNull byte[]

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

default int

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

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

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

Public methods

fromBool

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicBoolfromBool(boolean constant)

Creates a boolean DynamicDataValue.

fromByteArray

Added in 1.0.0
default static @NonNull DynamicDataBuilders.DynamicDataValue<ObjectfromByteArray(@NonNull byte[] byteArray)

Creates a DynamicDataValue from a byte array generated by toDynamicDataValueByteArray.

Throws
java.lang.IllegalArgumentException

if the byte array does not contain a valid serialization

fromByteArray

Added in 1.0.0
default static @NonNull DynamicDataBuilders.DynamicDataValue<ObjectfromByteArray(@NonNull byte[] byteArray, int offset, int length)

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

Throws
java.lang.IllegalArgumentException

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

fromColor

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicColorfromColor(@ColorInt int constant)

Creates a color DynamicDataValue.

fromDuration

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicDurationfromDuration(@NonNull Duration constant)

Creates a DurationDynamicDataValue.

fromFloat

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicFloatfromFloat(float constant)

Creates a float DynamicDataValue.

fromInstant

Added in 1.1.0
@RequiresSchemaVersion(major = 1, minor = 300)
default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicInstantfromInstant(@NonNull Instant constant)

Creates an InstantDynamicDataValue.

fromInt

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicInt32fromInt(int constant)

Creates a int DynamicDataValue.

fromString

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicDataBuilders.DynamicDataValue<DynamicBuilders.DynamicStringfromString(@NonNull String constant)

Creates a string DynamicDataValue.

getBoolValue

Added in 1.1.0
default boolean getBoolValue()

Returns the boolean value stored in this DynamicDataValue.

Throws
java.lang.IllegalStateException

if the DynamicDataValue doesn't contain a boolean value.

getColorValue

Added in 1.1.0
default @ColorInt int getColorValue()

Returns the color value stored in this DynamicDataValue.

Throws
java.lang.IllegalStateException

if the DynamicDataValue doesn't contain a color value.

getDurationValue

Added in 1.1.0
default @NonNull Duration getDurationValue()

Returns the Duration value stored in this DynamicDataValue.

Throws
java.lang.IllegalStateException

if the DynamicDataValue doesn't contain an value.

getFloatValue

Added in 1.1.0
default float getFloatValue()

Returns the float value stored in this DynamicDataValue.

Throws
java.lang.IllegalStateException

if the DynamicDataValue doesn't contain a float value.

getInstantValue

Added in 1.1.0
default @NonNull Instant getInstantValue()

Returns the Instant value stored in this DynamicDataValue.

Throws
java.lang.IllegalStateException

if the DynamicDataValue doesn't contain an value.

getIntValue

Added in 1.1.0
default int getIntValue()

Returns the int value stored in this DynamicDataValue.

Throws
java.lang.IllegalStateException

if the DynamicDataValue doesn't contain an int value.

getStringValue

Added in 1.1.0
default @NonNull String getStringValue()

Returns the String value stored in this DynamicDataValue.

Throws
java.lang.IllegalStateException

if the DynamicDataValue doesn't contain a String value.

hasBoolValue

Added in 1.1.0
default boolean hasBoolValue()

Returns true if the DynamicDataValue contains a boolean value. Otherwise returns false.

hasColorValue

Added in 1.1.0
default boolean hasColorValue()

Returns true if the DynamicDataValue contains a color value. Otherwise returns false.

hasDurationValue

Added in 1.1.0
default boolean hasDurationValue()

Returns true if the DynamicDataValue contains an Duration value. Otherwise returns false.

hasFloatValue

Added in 1.1.0
default boolean hasFloatValue()

Returns true if the DynamicDataValue contains a float value. Otherwise returns false.

hasInstantValue

Added in 1.1.0
default boolean hasInstantValue()

Returns true if the DynamicDataValue contains an Instant value. Otherwise returns false.

hasIntValue

Added in 1.1.0
default boolean hasIntValue()

Returns true if the DynamicDataValue contains an int value. Otherwise returns false.

hasStringValue

Added in 1.1.0
default boolean hasStringValue()

Returns true if the DynamicDataValue contains a String value. Otherwise returns false.

toDynamicDataValueByteArray

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

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

toDynamicDataValueByteArray

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

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

Throws
java.lang.IllegalArgumentException

if the byte array is too small

toDynamicDataValueByteArray

Added in 1.0.0
default int toDynamicDataValueByteArray(
    @NonNull byte[] byteArray,
    int offset,
    int length
)

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

Throws
java.lang.IllegalArgumentException

if the byte array is too small