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.
Description
Section titled “Description”UI.useStore goes through it; you call it yourself only to reach a shared store outside a UI.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
T | useStore(Class | 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. |
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 | The @UIStoreData annotation of a store class. |
Method details
Section titled “Method details”useStore
Section titled “useStore”<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.
destroyStore
Section titled “destroyStore”void destroyStore(UIStore store) static
Forgets a shared store and runs its destroy().
saveStore
Section titled “saveStore”void saveStore(UIStore store) static
Writes a PERMANENT store to its file; a store of another scope is ignored.
saveAll
Section titled “saveAll”void saveAll() static
Writes every shared PERMANENT store to its file.
getData
Section titled “getData”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
