Class Scope

java.lang.Object
arez.persist.runtime.Scope

@ArezComponent public abstract class Scope extends Object
A scope is used to control the lifecycle of state storage. State containing within a scope can be removed from the store using a single call to ArezPersist.releaseScope(Scope). Scopes can be nested within other scopes and releasing a scope, releases all child scopes. There is a single root scope in which all other scopes are nested and it can be retrieved using the ArezPersist.getRootScope() method.

A scope may be disposed. It is no longer valid to create nested scopes, store state or retrieve state with disposed scopes.

  • Field Details

  • Method Details

    • getName

      @Nonnull public String getName()
      Return the simple name of the scope. The simple name is the name that was used to create the scope.
      Returns:
      the simple name of the scope.
    • getQualifiedName

      Return the qualified name of the scope. The qualified name includes the parent scopes name followed by a "." character unless the parent scope is the root scope.
      Returns:
      the qualified name of the scope.
    • findOrCreateScope

      @Nonnull public Scope findOrCreateScope(@Nonnull String name)
      Find or create a scope directly nested under the current scope. This must not be invoked on a disposed scope.
      Parameters:
      name - the name of the nested scope.
      Returns:
      the scope.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNestedScopes

      @Nonnull public Collection<Scope> getNestedScopes()