DynamicBuilders.DynamicString


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


Interface defining a dynamic string type.

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

Summary

Public functions

DynamicBuilders.DynamicString
@RequiresSchemaVersion(major = 1, minor = 200)
concat(other: 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.

java-static DynamicBuilders.DynamicString
@RequiresSchemaVersion(major = 1, minor = 200)
constant(constant: String)

Creates a constant-valued DynamicString.

java-static DynamicBuilders.DynamicString
@RequiresSchemaVersion(major = 1, minor = 200)
format(format: String, args: Array<Any!>)

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

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

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

java-static DynamicBuilders.DynamicString

Creates a DynamicString from a byte array generated by toDynamicStringByteArray.

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

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

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

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

ByteArray<Byte>

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

Int

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

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

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

Extension functions

LayoutString
@RequiresSchemaVersion(major = 1, minor = 200)
DynamicBuilders.DynamicString.asLayoutString(
    staticValue: String,
    layoutConstraint: TypeBuilders.StringLayoutConstraint
)

Extension for creating a LayoutString from a DynamicString

Public functions

concat

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
fun concat(other: DynamicBuilders.DynamicString): 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.

Parameters
other: DynamicBuilders.DynamicString

The right hand side operand of the concatenation.

constant

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

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

format

@RequiresSchemaVersion(major = 1, minor = 200)
java-static fun format(format: String, args: Array<Any!>): DynamicBuilders.DynamicString

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

See also
DynamicFormatter

from

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

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
dynamicDataKey: DynamicDataKey<DynamicBuilders.DynamicString!>

The source key to a DynamicDataValue with a string value.

fromByteArray

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

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
java-static fun fromByteArray(byteArray: ByteArray, offset: Int, length: Int): DynamicBuilders.DynamicString

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)
java-static fun onCondition(condition: DynamicBuilders.DynamicBool): ConditionScopes.ConditionScope<DynamicBuilders.DynamicString!, String!>

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
condition: DynamicBuilders.DynamicBool

The value used for evaluting this condition.

toDynamicStringByteArray

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

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

toDynamicStringByteArray

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

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
fun toDynamicStringByteArray(byteArray: ByteArray, offset: Int, length: Int): Int

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

Extension functions

@RequiresSchemaVersion(major = 1, minor = 200)
fun DynamicBuilders.DynamicString.asLayoutString(
    staticValue: String,
    layoutConstraint: TypeBuilders.StringLayoutConstraint
): LayoutString

Extension for creating a LayoutString from a DynamicString

Parameters
staticValue: String

the static value that can be used when the dynamicValue can't be resolved.

layoutConstraint: TypeBuilders.StringLayoutConstraint

used to correctly measure layout Text element size and align text to ensure that the layout is of a known size during the layout pass regardless of the dynamicValue String.