TreeState
abstract class TreeState<F : CopySortIdFlat<F>, C : Created, U : Updated, D : Deleted, M : Moved> : ITreeState<F>
The state of a Tree: its nodes as flat Fs. Subclass it with the concrete events (C, U, D, M) and toFlat; the compiler binds the sourcing functions declared here with the subclass's type arguments:
class CategoryState(override val id: String) :
TreeState<FlatCategory, CategoryCreated, CategoryUpdated, CategoryDeleted, CategoryMoved>() {
override fun Flat.toFlat(): FlatCategory = FlatCategory(name, code, sortId)
}Content copied to clipboard