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.
|
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 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.
|
Set<Route> |
getIgnoredRoutes(String versionId,
char separator)
Returns which blocks (represented by their routes) to ignore (including their contents) while updating to the
specified version ID.
|
Map<MergeRule,Boolean> |
getMergeRules()
Returns merge preservation rules.
|
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 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 to split string routes bypublic Map<Route,Route> getRelocations(@NotNull String versionId, char separator)
from route = to route
format) that took effect at the given version ID.versionId
- version for which to return the relocationsseparator
- separator to split string route relocations bypublic 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 static UpdaterSettings.Builder builder()
public static UpdaterSettings.Builder builder(UpdaterSettings settings)
settings
- preset settingsCopyright © 2022. All rights reserved.