DynamicTypeEvaluator.Config.Builder


public final class DynamicTypeEvaluator.Config.Builder


Builds a DynamicTypeEvaluator.Config.

Summary

Public constructors

Public methods

@NonNull DynamicTypeEvaluator.Config.Builder
addPlatformDataProvider(
    @NonNull PlatformDataProvider platformDataProvider,
    @NonNull Set<PlatformDataKey<Object>> supportedDataKeys
)

Add a platform data provider and specify the keys it can provide dynamic data for.

@NonNull DynamicTypeEvaluator.Config
@NonNull DynamicTypeEvaluator.Config.Builder

Sets the quota manager used for limiting the number of concurrently running animations.

@NonNull DynamicTypeEvaluator.Config.Builder

Sets the clock (Instant supplier) used for providing time data to bindings.

@NonNull DynamicTypeEvaluator.Config.Builder

Sets the quota manager used for limiting the total size of dynamic types in the pipeline.

@NonNull DynamicTypeEvaluator.Config.Builder

Sets the notifier used for updating the platform time data.

@NonNull DynamicTypeEvaluator.Config.Builder

Sets the state store that will be used for dereferencing the state keys in the dynamic types.

Public constructors

Builder

Added in 1.0.0
public Builder()

Public methods

addPlatformDataProvider

Added in 1.0.0
public @NonNull DynamicTypeEvaluator.Config.Builder addPlatformDataProvider(
    @NonNull PlatformDataProvider platformDataProvider,
    @NonNull Set<PlatformDataKey<Object>> supportedDataKeys
)

Add a platform data provider and specify the keys it can provide dynamic data for.

The provider must support at least one key. If the provider supports multiple keys, they should not be independent, as their values should always update together. One data key must not have multiple providers, or an exception will be thrown.

Throws
java.lang.IllegalArgumentException

If a PlatformDataProvider supports an empty key set or if a key has multiple data providers.

build

Added in 1.0.0
public @NonNull DynamicTypeEvaluator.Config build()

setAnimationQuotaManager

Added in 1.0.0
public @NonNull DynamicTypeEvaluator.Config.Builder setAnimationQuotaManager(@NonNull QuotaManager value)

Sets the quota manager used for limiting the number of concurrently running animations.

If not set, animations are disabled and non-infinite animations will have the end value immediately.

setClock

Added in 1.0.0
@VisibleForTesting
public @NonNull DynamicTypeEvaluator.Config.Builder setClock(@NonNull Supplier<Instant> clock)

Sets the clock (Instant supplier) used for providing time data to bindings. If not set, on every reevaluation, platform time for dynamic values will be set to now.

setDynamicTypesQuotaManager

Added in 1.0.0
public @NonNull DynamicTypeEvaluator.Config.Builder setDynamicTypesQuotaManager(@NonNull QuotaManager value)

Sets the quota manager used for limiting the total size of dynamic types in the pipeline.

If not set, number of dynamic types will not be restricted.

setPlatformTimeUpdateNotifier

Added in 1.0.0
public @NonNull DynamicTypeEvaluator.Config.Builder setPlatformTimeUpdateNotifier(
    @NonNull PlatformTimeUpdateNotifier notifier
)

Sets the notifier used for updating the platform time data. If not set, by default platform time will be updated at 1Hz using a Handler on the main thread.

setStateStore

Added in 1.0.0
public @NonNull DynamicTypeEvaluator.Config.Builder setStateStore(@NonNull StateStore value)

Sets the state store that will be used for dereferencing the state keys in the dynamic types.

If not set, it's the equivalent of setting an empty state store (state bindings will trigger onInvalidated).