Type Parameters:
T - the value type
All Superinterfaces:
StateToken
All Known Subinterfaces:
MutableState<T>
All Known Implementing Classes:
InitialStateImpl, LazyStateImpl, MutableStateImpl

public interface State<T> extends StateToken
Read access to a per-context value identified by this token. Values live in the context's session and are dropped when the context closes.
  • Method Summary

    Modifier and Type
    Method
    Description
    get(@NotNull ViewContext context)
    Reads this token's value for the given context.
  • Method Details

    • get

      @Nullable T get(@NotNull @NotNull ViewContext context)
      Reads this token's value for the given context. Callable from any thread, but values are only coherent on the main thread.
      Parameters:
      context - an active context of the owning view
      Returns:
      the current value, possibly null
      Throws:
      StaleContextException - when the context belongs to another view or is closed