- Type Parameters:
T- the plain configuration POJO type
public interface Config<T>
Lifecycle handle for a plain
@Configuration POJO loaded via
ConfigurationLoader.from(path).loadPlain(...).
Because the POJO does not extend anything, persistence operations live on this handle instead of on the configuration object itself:
Config<AppConfig> config = ConfigurationLoader.from(path).loadPlain(AppConfig::new);
AppConfig app = config.get();
app.setPort(9090);
config.save();
config.reload();
-
Method Summary
Modifier and TypeMethodDescriptionget()Returns the configuration POJO.Returns the per-key issues from the last load or reload (TOML and Properties formats).booleanReturns whether the configuration file is being watched for changes.voidreload()Reloads the POJO's fields from the configuration file and re-runs@PostInjectmethods.voidsave()Saves the current state of the POJO to the configuration file.voidsetOnAutoReload(Runnable listener) Registers a listener invoked after an automatic reload (requires auto-reload to be enabled via the loader builder).voidStops watching the configuration file.
-
Method Details
-
get
T get()Returns the configuration POJO. The same instance is returned for the lifetime of this handle;reload()updates its fields in place. -
save
void save()Saves the current state of the POJO to the configuration file. -
reload
void reload()Reloads the POJO's fields from the configuration file and re-runs@PostInjectmethods. -
getLastLoadIssues
Returns the per-key issues from the last load or reload (TOML and Properties formats). SeeConfigurablePojo.getLastLoadIssues()for details on the semantics. -
setOnAutoReload
Registers a listener invoked after an automatic reload (requires auto-reload to be enabled via the loader builder). Runs on the watcher thread — keep it short and thread-safe. Pass null to remove. -
isAutoReloadActive
boolean isAutoReloadActive()Returns whether the configuration file is being watched for changes. -
stopAutoReload
void stopAutoReload()
-