public abstract class AbstractConfig extends java.lang.Object implements Config, java.lang.Cloneable
Map to store its values. In practice it's
often a HashMap, or a ConcurrentHashMap if the config is concurrent, but it accepts any type
of Map.| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractConfig.EntryWrapper
A wrapper around a
Map.Entry<String, Object>. |
Config.Entry| Modifier and Type | Field and Description |
|---|---|
protected java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> |
mapCreator |
| Constructor and Description |
|---|
AbstractConfig(boolean concurrent)
Creates a new AbstractConfig backed by a new
Map. |
AbstractConfig(java.util.Map<java.lang.String,java.lang.Object> map)
Creates a new AbstractConfig backed by the specified
Map. |
AbstractConfig(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
Creates a new AbstractConfig with all backing maps supplied by the given
Supplier. |
AbstractConfig(UnmodifiableConfig toCopy,
boolean concurrent)
Creates a new AbstractConfig that is a copy of the specified config.
|
AbstractConfig(UnmodifiableConfig toCopy,
java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
Creates a new AbstractConfig that is a copy of the specified config, and with
all backing maps supplied by the given
Supplier. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.util.List<java.lang.String> path,
java.lang.Object value)
Adds a config value.
|
void |
clear()
Removes all values from the config.
|
abstract AbstractConfig |
clone()
Creates and return a copy of this config.
|
boolean |
contains(java.util.List<java.lang.String> path)
Checks if the config contains a value at some path.
|
java.util.Set<? extends Config.Entry> |
entrySet()
Returns a Set view of the config's entries.
|
boolean |
equals(java.lang.Object obj) |
protected 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.
|
<T> T |
getRaw(java.util.List<java.lang.String> path)
Gets a value from the config.
|
protected static <T> java.util.function.Supplier<java.util.Map<java.lang.String,T>> |
getWildcardMapCreator(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator) |
int |
hashCode() |
boolean |
isNull(java.util.List<java.lang.String> path)
Checks if the config contains a null value at some path.
|
<T> T |
remove(java.util.List<java.lang.String> path)
Removes a value from the config.
|
<T> T |
set(java.util.List<java.lang.String> path,
java.lang.Object value)
Sets a config value.
|
int |
size()
Gets the size of the config.
|
java.lang.String |
toString() |
java.util.Map<java.lang.String,java.lang.Object> |
valueMap()
Returns a Map view of the config's values.
|
finalize, getClass, notify, notifyAll, wait, wait, waitadd, addAll, checked, concurrentCopy, concurrentCopy, copy, copy, copy, copy, createSubConfig, getDefaultMapCreator, inMemory, inMemoryConcurrent, inMemoryUniversal, inMemoryUniversalConcurrent, isInsertionOrderPreserved, of, of, ofConcurrent, putAll, remove, removeAll, set, setInsertionOrderPreserved, unmodifiable, update, update, wrapapply, apply, configFormat, 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, getShort, getShort, getShortOrElse, getShortOrElse, isEmpty, isNullprotected final java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator
public AbstractConfig(boolean concurrent)
Map.public AbstractConfig(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
Supplier.mapCreator - A supplier that will be called to create all config mapspublic AbstractConfig(java.util.Map<java.lang.String,java.lang.Object> map)
Map.map - the map to use to store the config values.public AbstractConfig(UnmodifiableConfig toCopy, boolean concurrent)
toCopy - the config to copypublic AbstractConfig(UnmodifiableConfig toCopy, java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
Supplier.toCopy - the config to copymapCreator - A supplier that will be called to create all config mapsprotected static <T> java.util.function.Supplier<java.util.Map<java.lang.String,T>> getDefaultMapCreator(boolean concurrent)
ConfigConfig.isInsertionOrderPreserved().getDefaultMapCreator in interface Configconcurrent - true to make the maps thread-safeprotected static <T> java.util.function.Supplier<java.util.Map<java.lang.String,T>> getWildcardMapCreator(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
public <T> T getRaw(java.util.List<java.lang.String> path)
UnmodifiableConfigNullObject.NULL_OBJECT to null.getRaw in interface UnmodifiableConfigT - the value's typepath - the value's path, each element of the list is a different part of the path.null if there is no such value.public <T> T set(java.util.List<java.lang.String> path,
java.lang.Object value)
Configpublic boolean add(java.util.List<java.lang.String> path,
java.lang.Object value)
Configpublic <T> T remove(java.util.List<java.lang.String> path)
Configpublic boolean contains(java.util.List<java.lang.String> path)
UnmodifiableConfigcontains in interface UnmodifiableConfigpath - the path to check, each element of the list is a different part of the path.true if the path is associated with a value, false if it's not.public boolean isNull(java.util.List<java.lang.String> path)
UnmodifiableConfigisNull in interface UnmodifiableConfigpath - the path to check, each element of the list is a different part of the path.true if the path is associated with NullObject.NULL_OBJECT,
false if it's associated with another value or with no value.public void clear()
Configpublic int size()
UnmodifiableConfigsize in interface UnmodifiableConfigpublic java.util.Map<java.lang.String,java.lang.Object> valueMap()
ConfigvalueMap in interface ConfigvalueMap in interface UnmodifiableConfigpublic java.util.Set<? extends Config.Entry> entrySet()
ConfigentrySet in interface ConfigentrySet in interface UnmodifiableConfigpublic abstract AbstractConfig clone()
clone in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object