SemanticsConfiguration


Describes the semantic information associated with the owning component

The information provided in the configuration is used to to generate the semantics tree.

Summary

Public constructors

Cmn

Public functions

open Boolean

Returns true if at least one property in this provider matches predicate.

Cmn
open operator Boolean
<T : Any?> contains(key: SemanticsPropertyKey<T>)

Returns whether key is present in this provider.

Cmn
SemanticsConfiguration

Returns an exact copy of this configuration.

Cmn
open operator Boolean
equals(other: Any?)
Cmn
open Unit

Invokes action for each property key and value in this provider.

Cmn
open operator T
<T : Any?> get(key: SemanticsPropertyKey<T>)

Retrieves the value for the given property, if one has been set.

Cmn
open T
<T : Any?> getOrElse(key: SemanticsPropertyKey<T>, defaultValue: () -> T)

Returns the value for key, or runs defaultValue if not set.

Cmn
open T?
<T : Any?> getOrElseNullable(
    key: SemanticsPropertyKey<T>,
    defaultValue: () -> T?
)

Returns the value for key, or runs defaultValue if not set.

Cmn
open Int
Cmn
open operator Iterator<Map.Entry<SemanticsPropertyKey<*>, Any?>>
Cmn
open operator Unit
<T : Any?> set(key: SemanticsPropertyKey<T>, value: T)
Cmn
open String
Cmn

Public properties

open Set<SemanticsPropertyKey<*>>

Keys in this provider whose SemanticsPropertyKey.accessibilityExtraKey is non-null.

Cmn
Boolean
Cmn
open Boolean

Whether the semantic information provided by the owning component and all of its descendants should be treated as one logical entity.

Cmn

Extension functions

T?

Retrieves the value for the given property, or null if the property is not present.

Cmn

Public constructors

SemanticsConfiguration

SemanticsConfiguration()

Public functions

anyProperty

@ExperimentalComposeUiHostApi
open fun anyProperty(predicate: (key: SemanticsPropertyKey<*>, Any?) -> Boolean): Boolean

Returns true if at least one property in this provider matches predicate. Stops at the first match.

Parameters
predicate: (key: SemanticsPropertyKey<*>, Any?) -> Boolean

Predicate invoked with each SemanticsPropertyKey and its associated value.

contains

open operator fun <T : Any?> contains(key: SemanticsPropertyKey<T>): Boolean

Returns whether key is present in this provider.

Parameters
key: SemanticsPropertyKey<T>

Property key to check.

Returns
Boolean

true if key is present, false otherwise.

copy

fun copy(): SemanticsConfiguration

Returns an exact copy of this configuration.

equals

open operator fun equals(other: Any?): Boolean

forEachProperty

@ExperimentalComposeUiHostApi
open fun forEachProperty(action: (key: SemanticsPropertyKey<*>, Any?) -> Unit): Unit

Invokes action for each property key and value in this provider.

Parameters
action: (key: SemanticsPropertyKey<*>, Any?) -> Unit

Callback invoked with each SemanticsPropertyKey and its associated value.

get

open operator fun <T : Any?> get(key: SemanticsPropertyKey<T>): T

Retrieves the value for the given property, if one has been set. If a value has not been set, throws IllegalStateException

getOrElse

open fun <T : Any?> getOrElse(key: SemanticsPropertyKey<T>, defaultValue: () -> T): T

Returns the value for key, or runs defaultValue if not set.

Parameters
key: SemanticsPropertyKey<T>

Property key to retrieve.

defaultValue: () -> T

Fallback supplier run when key is not present.

Returns
T

Value associated with key, or the result of defaultValue.

getOrElseNullable

open fun <T : Any?> getOrElseNullable(
    key: SemanticsPropertyKey<T>,
    defaultValue: () -> T?
): T?

Returns the value for key, or runs defaultValue if not set.

Parameters
key: SemanticsPropertyKey<T>

Property key to retrieve.

defaultValue: () -> T?

Fallback supplier run when key is not present.

Returns
T?

Value associated with key, or the result of defaultValue.

hashCode

open fun hashCode(): Int

iterator

open operator fun iterator(): Iterator<Map.Entry<SemanticsPropertyKey<*>, Any?>>

set

open operator fun <T : Any?> set(key: SemanticsPropertyKey<T>, value: T): Unit

toString

open fun toString(): String

Public properties

accessibilityExtraKeys

@ExperimentalComposeUiHostApi
open val accessibilityExtraKeys: Set<SemanticsPropertyKey<*>>

Keys in this provider whose SemanticsPropertyKey.accessibilityExtraKey is non-null.

Hosts expose these values as accessibility extras. Returns an empty set if there are none.

isClearingSemantics

var isClearingSemantics: Boolean

isMergingSemanticsOfDescendants

open var isMergingSemanticsOfDescendants: Boolean

Whether the semantic information provided by the owning component and all of its descendants should be treated as one logical entity.

If set to true, the descendants of the owning component's SemanticsNode will merge their semantic information into the SemanticsNode representing the owning component.

Extension functions

SemanticsConfiguration.getOrNull

fun <T : Any?> SemanticsConfiguration.getOrNull(key: SemanticsPropertyKey<T>): T?

Retrieves the value for the given property, or null if the property is not present.