public interface Config extends UnmodifiableConfig
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Config.Entry
A modifiable config entry.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.util.List<java.lang.String> path,
java.lang.Object value)
Adds a config value.
|
default boolean |
add(java.lang.String path,
java.lang.Object value)
Adds a config value.
|
default void |
addAll(UnmodifiableConfig config)
Adds all the values of a config to this config, without replacing existing entries.
|
default Config |
checked()
Returns a checked view of the config.
|
void |
clear()
Removes all values from the config.
|
static Config |
concurrentCopy(UnmodifiableConfig config)
Creates a new Config with the content of the given config.
|
static Config |
concurrentCopy(UnmodifiableConfig config,
ConfigFormat<?> format)
Creates a new Config with the content of the given config.
|
static Config |
copy(UnmodifiableConfig config)
Creates a new Config with the content of the given config.
|
static Config |
copy(UnmodifiableConfig config,
ConfigFormat<?> format)
Creates a new Config with the content of the given config.
|
static Config |
copy(UnmodifiableConfig config,
java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
Creates a new Config with the content of the given config.
|
static Config |
copy(UnmodifiableConfig config,
java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator,
ConfigFormat<?> format)
Creates a new Config with the content of the given config.
|
Config |
createSubConfig()
Creates a new sub config of this config, as created when a subconfig's creation is
implied by
set(List, Object) or add(List, Object). |
java.util.Set<? extends Config.Entry> |
entrySet()
Returns a Set view of the config's entries.
|
static <T> java.util.function.Supplier<java.util.Map<java.lang.String,T>> |
getDefaultMapCreator(boolean concurrent)
Returns a map supplier that fullfills the given requirements.
|
static <T> java.util.function.Supplier<java.util.Map<java.lang.String,T>> |
getDefaultMapCreator(boolean concurrent,
boolean insertionOrderPreserved)
Returns a map supplier that fulfills the given requirements.
|
static Config |
inMemory()
Creates a Config with format
InMemoryFormat.defaultInstance(). |
static Config |
inMemoryConcurrent()
Creates a thread-safe Config with format
InMemoryFormat.defaultInstance(). |
static Config |
inMemoryUniversal()
Creates a Config with format
InMemoryFormat.withUniversalSupport(). |
static Config |
inMemoryUniversalConcurrent()
Creates a thread-safe Config with format
InMemoryFormat.withUniversalSupport(). |
static boolean |
isInsertionOrderPreserved()
Checks if the newly created configs keep the insertion order of their content.
|
static Config |
of(ConfigFormat<? extends Config> format)
Creates a Config of the given format.
|
static Config |
of(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator,
ConfigFormat<?> format)
Creates a Config backed by a certain kind of map, given by a supplier.
|
static Config |
ofConcurrent(ConfigFormat<? extends Config> format)
Creates a thread-safe Config of the given format.
|
default void |
putAll(UnmodifiableConfig config)
Copies all the values of a config into this config.
|
<T> T |
remove(java.util.List<java.lang.String> path)
Removes a value from the config.
|
default <T> T |
remove(java.lang.String path)
Removes a value from the config.
|
default void |
removeAll(UnmodifiableConfig config)
Removes all the values of the given config from this config.
|
<T> T |
set(java.util.List<java.lang.String> path,
java.lang.Object value)
Sets a config value.
|
default <T> T |
set(java.lang.String path,
java.lang.Object value)
Sets a config value.
|
static void |
setInsertionOrderPreserved(boolean orderPreserved)
Modifies the behavior of the new configurations with regards to the preservation of the
order of config values.
|
default UnmodifiableConfig |
unmodifiable()
Returns an Unmodifiable view of the config.
|
default void |
update(java.util.List<java.lang.String> path,
java.lang.Object value)
For scala: sets a config value.
|
default void |
update(java.lang.String path,
java.lang.Object value)
For scala: sets a config value.
|
java.util.Map<java.lang.String,java.lang.Object> |
valueMap()
Returns a Map view of the config's values.
|
static Config |
wrap(java.util.Map<java.lang.String,java.lang.Object> map,
ConfigFormat<?> format)
Creates a Config backed by a Map.
|
apply, apply, configFormat, contains, contains, get, get, getByte, getByte, getByteOrElse, getByteOrElse, getChar, getChar, getCharOrElse, getCharOrElse, getEnum, getEnum, getEnum, getEnum, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getEnumOrElse, getInt, getInt, getIntOrElse, getIntOrElse, getIntOrElse, getIntOrElse, getLong, getLong, getLongOrElse, getLongOrElse, getLongOrElse, getLongOrElse, getOptional, getOptional, getOptionalEnum, getOptionalEnum, getOptionalEnum, getOptionalEnum, getOptionalInt, getOptionalInt, getOptionalLong, getOptionalLong, getOrElse, getOrElse, getOrElse, getOrElse, getRaw, getRaw, getShort, getShort, getShortOrElse, getShortOrElse, isEmpty, isNull, isNull, sizedefault <T> T set(java.lang.String path,
java.lang.Object value)
T - the type of the old valuepath - the value's path, each part separated by a dot. Example "a.b.c"value - the value to setnull<T> T set(java.util.List<java.lang.String> path,
java.lang.Object value)
T - the type of the old valuepath - the value's path, each element of the list is a different part of the path.value - the value to setnullboolean add(java.util.List<java.lang.String> path,
java.lang.Object value)
path - the value's path, each element of the list is a different part of the path.value - the value to setdefault boolean add(java.lang.String path,
java.lang.Object value)
path - the value's path, each part separated by a dot. Example "a.b.c"value - the value to setdefault void addAll(UnmodifiableConfig config)
config - the source configdefault void putAll(UnmodifiableConfig config)
config - the source configdefault <T> T remove(java.lang.String path)
T - the type of the old valuepath - the value's path, each part separated by a dot. Example "a.b.c"null<T> T remove(java.util.List<java.lang.String> path)
T - the type of the old valuepath - the value's path, each element of the list is a different part of the path.nulldefault void removeAll(UnmodifiableConfig config)
config - the values to removevoid clear()
default UnmodifiableConfig unmodifiable()
default Config checked()
ConfigFormat.supportsType(Class)
method. Trying to insert an unsupported value throws an IllegalArgumentException.
The values that are in the config when this method is called are also checked.
java.util.Map<java.lang.String,java.lang.Object> valueMap()
valueMap in interface UnmodifiableConfigjava.util.Set<? extends Config.Entry> entrySet()
entrySet in interface UnmodifiableConfigConfig createSubConfig()
set(List, Object) or add(List, Object).default void update(java.lang.String path,
java.lang.Object value)
path - the value's path, each part separated by a dot. Example "a.b.c"value - the value to setset(String, Object)default void update(java.util.List<java.lang.String> path,
java.lang.Object value)
path - the value's path, each element of the list is a different part of the path.value - the value to setset(List, Object)static Config of(ConfigFormat<? extends Config> format)
format - the config's formatstatic Config of(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator, ConfigFormat<?> format)
setInsertionOrderPreserved(boolean).mapCreator - a supplier which will be called to create all backing maps for this config (including sub-configs)format - the config's formatstatic Config ofConcurrent(ConfigFormat<? extends Config> format)
format - the config's formatstatic Config inMemory()
InMemoryFormat.defaultInstance().static Config inMemoryUniversal()
InMemoryFormat.withUniversalSupport().static Config inMemoryConcurrent()
InMemoryFormat.defaultInstance().static Config inMemoryUniversalConcurrent()
InMemoryFormat.withUniversalSupport().static Config wrap(java.util.Map<java.lang.String,java.lang.Object> map, ConfigFormat<?> format)
setInsertionOrderPreserved(boolean).map - the Map to useformat - the config's formatstatic Config copy(UnmodifiableConfig config)
config - the config to copystatic Config copy(UnmodifiableConfig config, java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
setInsertionOrderPreserved(boolean).config - the config to copymapCreator - a supplier which will be called to create all backing maps for this config (including sub-configs)of(Supplier, ConfigFormat)static Config copy(UnmodifiableConfig config, ConfigFormat<?> format)
config - the config to copyformat - the config's formatstatic Config copy(UnmodifiableConfig config, java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator, ConfigFormat<?> format)
setInsertionOrderPreserved(boolean).config - the config to copymapCreator - a supplier which will be called to create all backing maps for this config (including sub-configs)format - the config's formatof(Supplier, ConfigFormat)static Config concurrentCopy(UnmodifiableConfig config)
config - the config to copystatic Config concurrentCopy(UnmodifiableConfig config, ConfigFormat<?> format)
config - the config to copyformat - the config's formatstatic boolean isInsertionOrderPreserved()
setInsertionOrderPreserved(boolean).
This setting does not apply to configurations created from a Map, from another Config, or with a specific map supplier.
static void setInsertionOrderPreserved(boolean orderPreserved)
This setting does not apply to configurations created from a Map, from another Config, or with a specific map supplier.
orderPreserved - true to make the new configs preserve the insertion order of their
values, false to give no guarantee about the values ordering.isInsertionOrderPreserved()static <T> java.util.function.Supplier<java.util.Map<java.lang.String,T>> getDefaultMapCreator(boolean concurrent,
boolean insertionOrderPreserved)
concurrent - true to make the maps thread-safeinsertionOrderPreserved - true to make the maps preserve the insertion order of valuesstatic <T> java.util.function.Supplier<java.util.Map<java.lang.String,T>> getDefaultMapCreator(boolean concurrent)
isInsertionOrderPreserved().concurrent - true to make the maps thread-safe