Class ConfiguredMap<K,V>
- java.lang.Object
-
- cc.carm.lib.configuration.value.ValueManifest<T>
-
- cc.carm.lib.configuration.value.ConfigValue<T>
-
- cc.carm.lib.configuration.value.impl.CachedConfigValue<java.util.Map<K,V>>
-
- cc.carm.lib.configuration.value.standard.ConfiguredMap<K,V>
-
- All Implemented Interfaces:
java.util.Map<K,V>
public class ConfiguredMap<K,V> extends CachedConfigValue<java.util.Map<K,V>> implements java.util.Map<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>>constructorprotected @NotNull ValueAdapter<K>keyAdapterprotected @NotNull ValueAdapter<V>valueAdapter-
Fields inherited from class cc.carm.lib.configuration.value.impl.CachedConfigValue
cachedValue, parsedTime
-
Fields inherited from class cc.carm.lib.configuration.value.ValueManifest
defaultSupplier, holder, initializer, path, type
-
-
Constructor Summary
Constructors Constructor Description ConfiguredMap(@NotNull ValueManifest<java.util.Map<K,V>> manifest, @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> constructor, @NotNull ValueAdapter<K> keyAdapter, @NotNull ValueAdapter<V> valueAdapter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K,V>
ConfigMapCreator<K,V>builderOf(@NotNull ValueType<K> keyType, @NotNull ValueType<V> valueType)static <K,V>
ConfigMapCreator<K,V>builderOf(@NotNull java.lang.Class<K> keyType, @NotNull java.lang.Class<V> valueType)voidclear()booleancontainsKey(java.lang.Object key)booleancontainsValue(java.lang.Object value)@NotNull @Unmodifiable java.util.Set<java.util.Map.Entry<K,V>>entrySet()@NotNull java.util.Map<K,V>get()Gets the configured value (i.e., the value read from the source).Vget(java.lang.Object key)VgetNotNull(K key)<T> Thandle(java.util.function.Function<java.util.Map<K,V>,T> function)booleanisEmpty()@NotNull ValueAdapter<K>keyAdapter()@NotNull java.util.Set<K>keySet()@NotNull ValueType<K>keyType()@NotNull ConfiguredMap<K,V>modify(java.util.function.Consumer<java.util.Map<K,V>> consumer)static <K,V>
ConfiguredMap<K,V>of(@NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> constructor, @NotNull ValueAdapter<K> keyAdapter, @NotNull ValueAdapter<V> valueAdapter)Vput(K key, V value)voidputAll(@NotNull java.util.Map<? extends K,? extends V> m)Vremove(java.lang.Object key)voidset(@Nullable java.util.Map<K,V> value)Sets the value of this configuration.intsize()@NotNull ValueAdapter<V>valueAdapter()@NotNull java.util.Collection<V>values()@NotNull ValueType<V>valueType()-
Methods inherited from class cc.carm.lib.configuration.value.impl.CachedConfigValue
cacheExpired, getCachedOrDefault, getCachedOrDefault, getCachedValue, getDefaultFirst, parserFor, serializerFor, updateCache
-
Methods inherited from class cc.carm.lib.configuration.value.ConfigValue
getNotNull, getOrDefault, isDefault, optional, resolve, save, setDefault, setDefault
-
Methods inherited from class cc.carm.lib.configuration.value.ValueManifest
config, defaults, defaults, defaults, getData, hasDefaults, holder, holder, initialize, initialize, metadata, path, path, setData, type
-
-
-
-
Field Detail
-
constructor
@NotNull protected final @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> constructor
-
keyAdapter
@NotNull protected final @NotNull ValueAdapter<K> keyAdapter
-
valueAdapter
@NotNull protected final @NotNull ValueAdapter<V> valueAdapter
-
-
Constructor Detail
-
ConfiguredMap
public ConfiguredMap(@NotNull @NotNull ValueManifest<java.util.Map<K,V>> manifest, @NotNull @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> constructor, @NotNull @NotNull ValueAdapter<K> keyAdapter, @NotNull @NotNull ValueAdapter<V> valueAdapter)
-
-
Method Detail
-
builderOf
public static <K,V> ConfigMapCreator<K,V> builderOf(@NotNull @NotNull ValueType<K> keyType, @NotNull @NotNull ValueType<V> valueType)
-
builderOf
public static <K,V> ConfigMapCreator<K,V> builderOf(@NotNull @NotNull java.lang.Class<K> keyType, @NotNull @NotNull java.lang.Class<V> valueType)
-
of
public static <K,V> ConfiguredMap<K,V> of(@NotNull @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> constructor, @NotNull @NotNull ValueAdapter<K> keyAdapter, @NotNull @NotNull ValueAdapter<V> valueAdapter)
-
keyAdapter
@NotNull public @NotNull ValueAdapter<K> keyAdapter()
-
valueAdapter
@NotNull public @NotNull ValueAdapter<V> valueAdapter()
-
get
@NotNull public @NotNull java.util.Map<K,V> get()
Description copied from class:ConfigValueGets the configured value (i.e., the value read from the source).
If no default value was written during initialization, you can use theConfigValue.getOrDefault()method to obtain the default value when this value is empty.- Specified by:
getin classConfigValue<java.util.Map<K,V>>- Returns:
- Configured value
-
set
public void set(@Nullable @Nullable java.util.Map<K,V> value)Description copied from class:ConfigValueSets the value of this configuration.
After setting, the configuration file will NOT be saved automatically. To save, callConfigurationHolder.save().- Specified by:
setin classConfigValue<java.util.Map<K,V>>- Parameters:
value- The value to set
-
modify
@NotNull public @NotNull ConfiguredMap<K,V> modify(java.util.function.Consumer<java.util.Map<K,V>> consumer)
-
containsKey
public boolean containsKey(java.lang.Object key)
-
containsValue
public boolean containsValue(java.lang.Object value)
-
keySet
@NotNull public @NotNull java.util.Set<K> keySet()
-
values
@NotNull public @NotNull java.util.Collection<V> values()
-
-