Skip to content

UIStoreHook

final class UIStoreHook
Package: dev.joid.lib.ui.core.hook.store · Module: core · Source: UIStoreHook.java

Creates, caches, saves and destroys the stores that the UIs use.

UI.useStore goes through it; you call it yourself only to reach a shared store outside a UI.

ReturnsSignatureSummary
TuseStore(Class clazz, Supplier factory) staticReturns the shared store of this class when it exists; otherwise creates one with the factory, runs init() and, for a PERMANENT store, restores its file.
voiddestroyStore(UIStore store) staticForgets a shared store and runs its destroy().
voidsaveStore(UIStore store) staticWrites a PERMANENT store to its file; a store of another scope is ignored.
voidsaveAll() staticWrites every shared PERMANENT store to its file.
UIStoreDatagetData(Class<? extends UIStore> clazz) staticThe @UIStoreData annotation of a store class.

<T extends UIStore> T useStore(Class<T> clazz, Supplier<T> factory) static

Returns the shared store of this class when it exists; otherwise creates one with the factory, runs init() and, for a PERMANENT store, restores its file. A GLOBAL or PERMANENT store is kept for the next calls; a LOCAL store is not.

void destroyStore(UIStore store) static

Forgets a shared store and runs its destroy().

void saveStore(UIStore store) static

Writes a PERMANENT store to its file; a store of another scope is ignored.

void saveAll() static

Writes every shared PERMANENT store to its file.

UIStoreData getData(Class<? extends UIStore> clazz) static

Throws:

  • IllegalStateException: The store … has no @UIStoreData annotation, add it to the class

The @UIStoreData annotation of a store class. Throws an IllegalStateException when the class has none.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page