Class ArezPersist

java.lang.Object
arez.persist.runtime.ArezPersist

@OmitClinit public final class ArezPersist extends Object
Provide an interface to register and access stores and access the root scope as well as global configuration settings.
  • Method Details

    • shouldCheckApiInvariants

      @OmitSymbol public static boolean shouldCheckApiInvariants()
      Return true if apiInvariants will be checked.
      Returns:
      true if apiInvariants will be checked.
    • isApplicationStoreEnabled

      @OmitSymbol public static boolean isApplicationStoreEnabled()
      Return true if the in-memory application store should be registered by the framework.
      Returns:
      true if the in-memory application store should be registered by the framework.
    • getRootScope

      @Nonnull public static Scope getRootScope()
      Return the root scope under which all other scopes are nested.
      Returns:
      the root scope under which all other scopes are nested.
    • registerStore

      @Nonnull public static SafeProcedure registerStore(@Nonnull String name, @Nonnull StorageService service)
      Register a store with specified name and storage service. It is an error to register multiple stores with the same name.

      As part of the register operation, the store will attempt to restore state from the storage service. If an error occurs during the restore, then the error will be logged and registration will complete.

      Parameters:
      name - the name of the store.
      service - the associated StorageService.
      Returns:
      the action to invoke to deregister service.
    • getStore

      @Nonnull public static Store getStore(@Nonnull String name)
      Return the store that is registered with the specified name. It is an error to invoke this method without registering a store under this name.
      Parameters:
      name - the name of the store.
      Returns:
      the store.
    • findScope

      @Nullable public static Scope findScope(@Nonnull String qualifiedName)
      Find the scope with the specified name. The name can actually consist of name components separated by a "." character. Each name component is nested within the scope identified by the prior name component. i.e. The name "dashboard.finance.entry" will look for the scope named "entry" nested in a scope named "finance" nested in a scope named "dashboard".
      Parameters:
      qualifiedName - the qualified scope name.
      Returns:
      the scope if it exists.
    • findOrCreateScope

      @Nonnull public static Scope findOrCreateScope(@Nonnull String qualifiedName)
      Find the scope with the specified name and if it does not exist then create it. The name can actually consist of name components separated by a "." character. Each name component is nested within the scope identified by the prior name component. i.e. The name "dashboard.finance.entry" will look for the scope named "entry" nested in a scope named "finance" nested in a scope named "dashboard".
      Parameters:
      qualifiedName - the qualified scope name.
      Returns:
      the scope.
    • disposeScope

      public static void disposeScope(@Nonnull Scope scope)
      Dispose the specified scope. A dispose operation first performs a releaseScope(Scope) on the scope, then attempts to dispose all nested scopes and finally disposes the specified scope. A disposed scope should no longer be used to store state. It is an error to attempt to dispose the root scope.
      Parameters:
      scope - the scope to dispose.
    • releaseScope

      public static void releaseScope(@Nonnull Scope scope)
      Release the specified scope. A release operation removes any state associated with the scope and any nested scope.
      Parameters:
      scope - the scope to release.
    • registerConverter

      public static <A> SafeProcedure registerConverter(@Nonnull Class<A> type, @Nonnull Converter<A,?> converter)
      Register a converter for a type. It is an error to register multiple converters with the same name.
      Type Parameters:
      A - the type of the value.
      Parameters:
      type - the application type.
      converter - the converter.
      Returns:
      the action to invoke to deregister converter.
    • getConverter

      @Nonnull public static <A> Converter<A,?> getConverter(@Nonnull Class<A> type)
      Return the converter registered for the specified application type or the identity converter if none are specified.
      Type Parameters:
      A - the type of the value.
      Parameters:
      type - the application type.
      Returns:
      the converter if any.