DynamicBuilders.DynamicString


@RequiresSchemaVersion(major = 1, minor = 200)
public interface DynamicBuilders.DynamicString extends DynamicBuilders.DynamicType


Interface defining a dynamic string type.

DynamicString string value is subject to being truncated if it's too long.

Summary

Public methods

default @NonNull DynamicBuilders.DynamicString

Returns a new DynamicString that has the result of concatenating this with other. i.e. result = this + other The resulted is subject to being truncated if it's too long.

default static @NonNull DynamicBuilders.DynamicString
@RequiresSchemaVersion(major = 1, minor = 200)
constant(@NonNull String constant)

Creates a constant-valued DynamicString.

default static @NonNull DynamicBuilders.DynamicString
@RequiresSchemaVersion(major = 1, minor = 200)
format(@NonNull String format, @NonNull Object[] args)

Equivalent of format but supports DynamicTypes, and returns a DynamicString.

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

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

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

Creates a DynamicString from a byte array generated by toDynamicStringByteArray.

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

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

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

Creates a DynamicString that is bound to the result of a conditional expression.

default @NonNull byte[]

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

default int
toDynamicStringByteArray(@NonNull byte[] byteArray)

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

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

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

Public methods

concat

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default @NonNull DynamicBuilders.DynamicString concat(@NonNull DynamicBuilders.DynamicString other)

Returns a new DynamicString that has the result of concatenating this with other. i.e. result = this + other The resulted is subject to being truncated if it's too long.

Parameters
@NonNull DynamicBuilders.DynamicString other

The right hand side operand of the concatenation.

constant

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

Creates a constant-valued DynamicString. The resulted DynamicString is subject to being truncated if it's too long.

format

@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicString format(@NonNull String format, @NonNull Object[] args)

Equivalent of format but supports DynamicTypes, and returns a DynamicString.

See also
DynamicFormatter

from

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull DynamicBuilders.DynamicString from(
    @NonNull DynamicDataKey<DynamicBuilders.DynamicString> dynamicDataKey
)

Creates a DynamicString that is bound to the value of an item of the State. The resulted DynamicString is subject to being truncated if it's too long.

Parameters
@NonNull DynamicDataKey<DynamicBuilders.DynamicString> dynamicDataKey

The source key to a DynamicDataValue with a string value.

fromByteArray

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

Creates a DynamicString from a byte array generated by toDynamicStringByteArray.

Throws
java.lang.IllegalArgumentException

if the byte array does not contain a valid serialization

fromByteArray

Added in 1.0.0
default static @NonNull DynamicBuilders.DynamicString fromByteArray(@NonNull byte[] byteArray, int offset, int length)

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

Throws
java.lang.IllegalArgumentException

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

onCondition

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
default static @NonNull ConditionScopes.ConditionScope<DynamicBuilders.DynamicStringStringonCondition(@NonNull DynamicBuilders.DynamicBool condition)

Creates a DynamicString that is bound to the result of a conditional expression. It will use the value given in either use or elseUse depending on the value yielded from condition.

Parameters
@NonNull DynamicBuilders.DynamicBool condition

The value used for evaluting this condition.

toDynamicStringByteArray

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

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

toDynamicStringByteArray

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

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

Throws
java.lang.IllegalArgumentException

if the byte array is too small

toDynamicStringByteArray

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

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

Throws
java.lang.IllegalArgumentException

if the byte array is too small