Package de.bsommerfeld.jshepherd.core
Interface PersistenceDelegate<T>
- Type Parameters:
T- The configuration POJO type this delegate handles.
- All Known Implementing Classes:
AbstractPersistenceDelegate
public interface PersistenceDelegate<T>
Internal interface for handling the actual persistence mechanics (loading, saving, reloading) for a given
configuration POJO type — either a
ConfigurablePojo subclass or a plain @Configuration class.-
Method Summary
Modifier and TypeMethodDescriptionReturns the per-key issues recorded during the last load or reload.loadInitial(Supplier<T> defaultPojoSupplier) Loads the initial POJO instance from the persistent store, or creates and saves a default if the store is new or empty.voidReloads data from the persistent store into the provided POJO instance, updating its fields.voidSaves the provided POJO instance to the persistent store.
-
Method Details
-
save
Saves the provided POJO instance to the persistent store.- Parameters:
pojoInstance- The POJO instance to save.
-
reload
Reloads data from the persistent store into the provided POJO instance, updating its fields.- Parameters:
pojoInstanceToUpdate- The POJO instance whose fields should be updated.
-
loadInitial
Loads the initial POJO instance from the persistent store, or creates and saves a default if the store is new or empty.- Parameters:
defaultPojoSupplier- Supplier for creating a default POJO instance.- Returns:
- The loaded or newly created default POJO instance.
-
getLastLoadIssues
Returns the per-key issues recorded during the last load or reload.- Returns:
- an immutable list; empty if the last load was clean
-