Package com.vaadin.signals.impl
Class UsageTracker
java.lang.Object
com.vaadin.signals.impl.UsageTracker
Tracks signal value read operations while a task is run.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceTracks the state of some used value. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final UsageTracker.UsageA usage that doesn't have any changes and never fires any events. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisActive()Checks whether a usage tracker is currently active.static voidregisterUsage(UsageTracker.Usage usage) Registers a usage with the current usage tracker.static UsageTracker.UsageRuns the given task while collecting all cases where a managed value is used.static voidtrack(Runnable task, Consumer<UsageTracker.Usage> tracker) Runs the given task while reacting to all cases where a managed value is used.static <T> TRuns the given supplier without tracking usage even if a usage tracker is active.
-
Field Details
-
NO_USAGE
A usage that doesn't have any changes and never fires any events.
-
-
Method Details
-
track
Runs the given task while collecting all cases where a managed value is used.- Parameters:
task- the task to run, notnull- Returns:
- a usage instance that combines all used managed values, not
null
-
track
Runs the given task while reacting to all cases where a managed value is used.- Parameters:
task- the task to run, notnulltracker- a consumer that receives all usages as they happen, notnull
-
untracked
Runs the given supplier without tracking usage even if a usage tracker is active.- Type Parameters:
T- the supplier type- Parameters:
task- the supplier task to run, notnull- Returns:
- the value returned from the supplier
-
registerUsage
Registers a usage with the current usage tracker. This method should be run only if usage tracking isactive.- Parameters:
usage- the usage instance to register, notnull
-
isActive
public static boolean isActive()Checks whether a usage tracker is currently active.- Returns:
trueif a usage tracker is active
-