AbstractCollectionSchema

Abstract schema representing collections of type T with elements of type TChildren whose schema is of type TSchema.

Inheritors

Constructors

Link copied to clipboard
constructor(elementsSchema: TSchema)

Properties

Link copied to clipboard

Schema of the collection's elements.

Link copied to clipboard
abstract val initialValue: T

Initial value for a value of this schema.

Link copied to clipboard

Whether this schema supports removing values concurrently.

Link copied to clipboard

Whether this schema supports setting values concurrently.

Link copied to clipboard
abstract val typeInfo: TypeInfo

Information about the type of value represented by this schema.

Link copied to clipboard
abstract val validations: List<Validation<T>>

List of validations used to validate this schema.

Functions

Link copied to clipboard
open fun assignableTo(type: KType): Boolean

Whether a value of this schema can be assigned to a variable with the provided type.

Link copied to clipboard
abstract suspend fun change(path: AbsolutePath, value: T, intoValue: Any?, eventsBus: SchemaEventsBus, setValue: suspend (value: T) -> Unit)

Changes value, a value of this schema stored by the form manager into the given value intoValue, sending events about the change through eventsBus. The provided path represents the path of the value being changed within the form manager. The value must be set via setValue, even if it hasn't changed; for parent schemas, it should typically be the same instance of value, but mutated to resemble intoValue.

Link copied to clipboard
abstract override fun children(path: AbsolutePath, schemaPath: AbsolutePath, value: T, fragment: AbsolutePathFragment): Flow<ValueInfo<TChildren>>

Returns a flow of information on the values matching fragment that are children of value, a value of this schema.

Link copied to clipboard
open override fun childrenSchemas(path: AbsolutePath, queriedPath: AbsolutePath, fragment: AbsolutePathFragment): Sequence<SchemaInfo<TChildren>>

Returns a sequence of information on the schemas matching fragment that are children of this schema. The provided path and queried path respectively represent the path of this schema and the path of the queried value within the form manager.

Link copied to clipboard
abstract override fun childrenStatesContainer(): CollectionState

Returns a "container" used to hold the states of the children of a value of this schema.

Link copied to clipboard
abstract suspend fun clone(value: T): T

Returns a clone (deep copy) of value.

Link copied to clipboard
fun Schema<*>.comparePaths(path1: String, path2: String): Int
fun Schema<*>.comparePaths(path1: Path, path2: Path): Int

Compares two paths of a schema according to the order in which children are defined in said schema. Returns a value > 0 if path1 is greater than path2, < 0 if path2 if greater than path1, or 0 otherwise.

Link copied to clipboard
abstract suspend fun destroy(path: AbsolutePath, value: T, eventsBus: SchemaEventsBus, removeValue: suspend (value: T) -> Unit)

Destroys and removes value, a value of this schema stored by the form manager, sending events about the destruction through eventsBus. The provided path represents the path of the value being destroyed within the form manager. removeValue should always be called to remove the value.

Link copied to clipboard
abstract suspend fun init(path: AbsolutePath, fromValue: Any?, eventsBus: SchemaEventsBus, setValue: suspend (value: T) -> Unit)

Initialises and sets a value of this schema from a given value fromValue to be stored by the form manager, sending events about the initialisation of the value through eventsBus. The provided path represents the path of the value being initialised within the form manager. The value must be set via setValue, which should always be called.

Link copied to clipboard
abstract suspend fun isValidChildFragment(value: T, fragment: AbsolutePathFragment): Boolean

Returns whether fragment is a valid identifier for a child of value: a value of this schema.

Link copied to clipboard

Returns whether fragment is a valid identifier for a child schema of this schema.

Link copied to clipboard
abstract suspend fun isValidRemoveFragment(value: T, fragment: AbsolutePathFragment): Boolean

Returns whether fragment can be used to remove a child of value, a value of this schema.

Link copied to clipboard
abstract suspend fun isValidSetFragment(value: T, fragment: AbsolutePathFragment): Boolean

Returns whether fragment can be used to set a child of value, a value of this schema.

Link copied to clipboard
abstract suspend fun remove(path: AbsolutePath, value: T, fragment: AbsolutePathFragment, eventsBus: SchemaEventsBus)

Removes from value, a value of this schema, all children identified by fragment, sending events about all modifications through eventsBus. The provided path represents the path of value within the form manager.

Link copied to clipboard
abstract suspend fun set(path: AbsolutePath, value: T, fragment: AbsolutePathFragment, childValue: Any?, eventsBus: SchemaEventsBus)

Sets the child(ren) of value, a value of this schema, identified by fragment with childValue, sending events about all modifications through eventsBus. The provided path represents the path of value within the form manager.