CompositionData

Known direct subclasses
CompositionGroup

CompositionGroup is a group of data slots tracked independently by composition.


A CompositionData is the data tracked by the composer during composition.

This interface is not intended to be used directly and is provided to allow the tools API to have access to data tracked during composition. The tools API should be used instead which provides a more usable interpretation of the slot table.

Summary

Public functions

open CompositionGroup?
find(identityToFind: Any)

Find a sub-group by identity.

Cmn

Public properties

Iterable<CompositionGroup>

Iterate the composition data in the group.

Cmn
Boolean

Returns true if no composition data has been collected.

Cmn

Extension functions

Group

Return a group tree for for the slot table that represents the entire content of the slot table.

android
T?
@UiToolingDataApi
<T : Any?> CompositionData.mapTree(
    factory: (CompositionGroup, SourceContext, List<T>) -> T?,
    cache: ContextCache
)

Return a tree of custom nodes for the slot table.

android

Public functions

find

open fun find(identityToFind: Any): CompositionGroup?

Find a sub-group by identity. Returns null if the group is not found or the implementation of this interface does not support finding groups by their identity. In other words, a null result from this method should not be interpreted as the identity is not a group in the composition data.

Public properties

compositionGroups

val compositionGroupsIterable<CompositionGroup>

Iterate the composition data in the group. The composition data is structured as a tree of values that corresponds to the call graph of the functions that produced the tree. Interspersed are groups that represents the nodes themselves.

isEmpty

val isEmptyBoolean

Returns true if no composition data has been collected. This occurs when the first composition into this composition data has not completed yet or, if it is a group, it doesn't contain any child groups.

Extension functions

@UiToolingDataApi
fun CompositionData.asTree(): Group

Return a group tree for for the slot table that represents the entire content of the slot table.

@UiToolingDataApi
fun <T : Any?> CompositionData.mapTree(
    factory: (CompositionGroup, SourceContext, List<T>) -> T?,
    cache: ContextCache = ContextCache()
): T?

Return a tree of custom nodes for the slot table.

The factory method will be called for every CompositionGroup in the slot tree and can be used to create custom nodes based on the passed arguments. The SourceContext argument gives access to additional information encoded in the CompositionGroup.sourceInfo. A return of null from factory means that the entire subtree will be ignored.

A cache can optionally be specified. If a client is calling mapTree multiple times, this can save some time if the values of CompositionGroup.sourceInfo are not unique.