public class UpdaterSettings extends Object
Settings introduced by BoostedYAML follow builder design pattern, e.g. you may build your own settings using
UpdaterSettings.builder() //configure// .build()
| Modifier and Type | Class and Description |
|---|---|
static class |
UpdaterSettings.Builder
Builder for updater settings.
|
static class |
UpdaterSettings.OptionSorting
Enum defining how options in sections should be sorted during merging.
|
| Modifier and Type | Field and Description |
|---|---|
static UpdaterSettings |
DEFAULT
Default updater settings.
|
static boolean |
DEFAULT_AUTO_SAVE
If to, by default, automatically save the file after updating.
|
static boolean |
DEFAULT_ENABLE_DOWNGRADING
If to enable file downgrading by default.
|
static boolean |
DEFAULT_KEEP_ALL
If to keep all non-merged content (present in the document, but not in the defaults) inside the document by
default.
|
static Map<MergeRule,Boolean> |
DEFAULT_MERGE_RULES
Default merge preservation rules.
|
static UpdaterSettings.OptionSorting |
DEFAULT_OPTION_SORTING
Default option sorting.
|
static Versioning |
DEFAULT_VERSIONING
Default versioning.
|
| Constructor and Description |
|---|
UpdaterSettings(UpdaterSettings.Builder builder)
Creates final, immutable updater settings from the given builder.
|
| Modifier and Type | Method and Description |
|---|---|
static UpdaterSettings.Builder |
builder()
Returns a new builder.
|
static UpdaterSettings.Builder |
builder(UpdaterSettings settings)
Returns a new builder with the same configuration as the given settings.
|
List<Consumer<YamlDocument>> |
getCustomLogic(String versionId)
Returns custom logic to run at the given version ID.
|
Set<Route> |
getIgnoredRoutes(String versionId,
char separator)
Returns which routes to ignore if updating to the specified version ID.
|
Map<Route,ValueMapper> |
getMappers(String versionId,
char separator)
Returns mappers to apply at the given version ID.
|
Map<MergeRule,Boolean> |
getMergeRules()
Returns merge preservation rules.
|
UpdaterSettings.OptionSorting |
getOptionSorting()
Returns how to sort options in sections during merging.
|
Map<Route,Route> |
getRelocations(String versionId,
char separator)
Returns relocations (in
from route = to route format) that took effect at the given version ID. |
Versioning |
getVersioning()
Returns the versioning.
|
boolean |
isAutoSave()
Sets if the file should automatically be saved using
YamlDocument.save() after the updater has finished
updating (does not save if nothing's changed). |
boolean |
isEnableDowngrading()
Returns if to enable downgrading.
|
boolean |
isKeepAll()
Returns if to keep all non-merged (that don't have an equivalent in the defaults) blocks in the document.
|
public static final boolean DEFAULT_AUTO_SAVE
public static final boolean DEFAULT_ENABLE_DOWNGRADING
public static final boolean DEFAULT_KEEP_ALL
public static final UpdaterSettings.OptionSorting DEFAULT_OPTION_SORTING
public static final Map<MergeRule,Boolean> DEFAULT_MERGE_RULES
public static final Versioning DEFAULT_VERSIONING
public static final UpdaterSettings DEFAULT
public UpdaterSettings(UpdaterSettings.Builder builder)
builder - the builderpublic Map<MergeRule,Boolean> getMergeRules()
The given map contains the merge rule as the key, with the value representing if to preserve content already in the document instead of the equivalent from the defaults.
public Set<Route> getIgnoredRoutes(@NotNull String versionId, char separator)
versionId - version for which to return the routesseparator - separator used to parse the string routespublic Map<Route,Route> getRelocations(@NotNull String versionId, char separator)
from route = to route format) that took effect at the given version ID.versionId - the version ID for which to return relocationsseparator - separator used to parse the string routespublic Map<Route,ValueMapper> getMappers(@NotNull String versionId, char separator)
versionId - the version ID for which to return mappersseparator - separator used to parse the string routespublic List<Consumer<YamlDocument>> getCustomLogic(@NotNull String versionId)
versionId - the version ID for which to return custom logicpublic Versioning getVersioning()
public boolean isEnableDowngrading()
public boolean isKeepAll()
public boolean isAutoSave()
YamlDocument.save() after the updater has finished
updating (does not save if nothing's changed).public UpdaterSettings.OptionSorting getOptionSorting()
public static UpdaterSettings.Builder builder()
public static UpdaterSettings.Builder builder(UpdaterSettings settings)
settings - preset settingsCopyright © 2022. All rights reserved.