Class ConfigValueMap<K,V,S>
- java.lang.Object
-
- cc.carm.lib.configuration.core.value.ValueManifest<T>
-
- cc.carm.lib.configuration.core.value.ConfigValue<T>
-
- cc.carm.lib.configuration.core.value.impl.CachedConfigValue<java.util.Map<K,V>>
-
- cc.carm.lib.configuration.core.value.impl.ConfigValueMap<K,V,S>
-
- All Implemented Interfaces:
java.util.Map<K,V>
- Direct Known Subclasses:
ConfiguredMap
,ConfiguredSectionMap
public abstract class ConfigValueMap<K,V,S> extends CachedConfigValue<java.util.Map<K,V>> implements java.util.Map<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull java.lang.Class<K>
keyClass
protected @NotNull ConfigDataFunction<java.lang.String,K>
keyParser
protected @NotNull ConfigDataFunction<K,java.lang.String>
keySerializer
protected @NotNull java.lang.Class<? super S>
sourceClass
protected @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>>
supplier
protected @NotNull java.lang.Class<V>
valueClass
protected @NotNull ConfigDataFunction<S,V>
valueParser
protected @NotNull ConfigDataFunction<V,java.lang.Object>
valueSerializer
-
Fields inherited from class cc.carm.lib.configuration.core.value.impl.CachedConfigValue
cachedValue, parsedTime
-
Fields inherited from class cc.carm.lib.configuration.core.value.ValueManifest
configPath, defaultValue, headerComments, inlineComment, provider
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ConfigValueMap(@NotNull ValueManifest<java.util.Map<K,V>> manifest, @NotNull java.lang.Class<? super S> sourceClass, @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> mapObjSupplier, @NotNull java.lang.Class<K> keyClass, @NotNull ConfigDataFunction<java.lang.String,K> keyParser, @NotNull java.lang.Class<V> valueClass, @NotNull ConfigDataFunction<S,V> valueParser, @NotNull ConfigDataFunction<K,java.lang.String> keySerializer, @NotNull ConfigDataFunction<V,java.lang.Object> valueSerializer)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <K,V>
@NotNull ConfigMapCreator<K,V>builderOf(@NotNull java.lang.Class<K> keyClass, @NotNull java.lang.Class<V> valueClass)
void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
@NotNull @Unmodifiable java.util.Set<java.util.Map.Entry<K,V>>
entrySet()
@NotNull java.util.Map<K,V>
get()
得到该配置的设定值(即读取到的值)。V
get(java.lang.Object key)
@NotNull java.lang.Class<K>
getKeyClass()
@NotNull ConfigDataFunction<java.lang.String,K>
getKeyParser()
@NotNull ConfigDataFunction<K,java.lang.String>
getKeySerializer()
V
getNotNull(java.lang.Object key)
abstract S
getSource(ConfigurationWrapper<?> section, java.lang.String dataKey)
@NotNull java.lang.Class<? super S>
getSourceClass()
@NotNull java.lang.Class<V>
getValueClass()
@NotNull ConfigDataFunction<S,V>
getValueParser()
@NotNull ConfigDataFunction<V,java.lang.Object>
getValueSerializer()
boolean
isEmpty()
@NotNull java.util.Set<K>
keySet()
@NotNull java.util.Map<K,V>
modifyMap(java.util.function.Consumer<java.util.Map<K,V>> consumer)
<T> T
modifyValue(java.util.function.Function<java.util.Map<K,V>,T> function)
V
put(K key, V value)
void
putAll(@NotNull java.util.Map<? extends K,? extends V> m)
V
remove(java.lang.Object key)
void
set(@Nullable java.util.Map<K,V> value)
设定该配置的值。int
size()
@NotNull java.util.Collection<V>
values()
-
Methods inherited from class cc.carm.lib.configuration.core.value.impl.CachedConfigValue
getCachedOrDefault, getCachedOrDefault, getCachedValue, getDefaultFirst, isExpired, updateCache
-
Methods inherited from class cc.carm.lib.configuration.core.value.ConfigValue
builder, getNotNull, getOptional, getOrDefault, initialize, isDefault, setDefault, setDefault
-
Methods inherited from class cc.carm.lib.configuration.core.value.ValueManifest
getConfigPath, getConfiguration, getDefaultValue, getHeaderComments, getInlineComment, getProvider, getValue, initialize, of, of, setDefaultValue, setValue
-
-
-
-
Field Detail
-
supplier
@NotNull protected final @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> supplier
-
sourceClass
@NotNull protected final @NotNull java.lang.Class<? super S> sourceClass
-
keyClass
@NotNull protected final @NotNull java.lang.Class<K> keyClass
-
valueClass
@NotNull protected final @NotNull java.lang.Class<V> valueClass
-
keyParser
@NotNull protected final @NotNull ConfigDataFunction<java.lang.String,K> keyParser
-
valueParser
@NotNull protected final @NotNull ConfigDataFunction<S,V> valueParser
-
keySerializer
@NotNull protected final @NotNull ConfigDataFunction<K,java.lang.String> keySerializer
-
valueSerializer
@NotNull protected final @NotNull ConfigDataFunction<V,java.lang.Object> valueSerializer
-
-
Constructor Detail
-
ConfigValueMap
protected ConfigValueMap(@NotNull @NotNull ValueManifest<java.util.Map<K,V>> manifest, @NotNull @NotNull java.lang.Class<? super S> sourceClass, @NotNull @NotNull java.util.function.Supplier<? extends java.util.Map<K,V>> mapObjSupplier, @NotNull @NotNull java.lang.Class<K> keyClass, @NotNull @NotNull ConfigDataFunction<java.lang.String,K> keyParser, @NotNull @NotNull java.lang.Class<V> valueClass, @NotNull @NotNull ConfigDataFunction<S,V> valueParser, @NotNull @NotNull ConfigDataFunction<K,java.lang.String> keySerializer, @NotNull @NotNull ConfigDataFunction<V,java.lang.Object> valueSerializer)
-
-
Method Detail
-
builderOf
@NotNull public static <K,V> @NotNull ConfigMapCreator<K,V> builderOf(@NotNull @NotNull java.lang.Class<K> keyClass, @NotNull @NotNull java.lang.Class<V> valueClass)
-
getSourceClass
@NotNull public @NotNull java.lang.Class<? super S> getSourceClass()
-
getKeyClass
@NotNull public @NotNull java.lang.Class<K> getKeyClass()
-
getValueClass
@NotNull public @NotNull java.lang.Class<V> getValueClass()
-
getKeyParser
@NotNull public @NotNull ConfigDataFunction<java.lang.String,K> getKeyParser()
-
getValueParser
@NotNull public @NotNull ConfigDataFunction<S,V> getValueParser()
-
getKeySerializer
@NotNull public @NotNull ConfigDataFunction<K,java.lang.String> getKeySerializer()
-
getValueSerializer
@NotNull public @NotNull ConfigDataFunction<V,java.lang.Object> getValueSerializer()
-
getSource
public abstract S getSource(ConfigurationWrapper<?> section, java.lang.String dataKey)
-
get
@NotNull public @NotNull java.util.Map<K,V> get()
Description copied from class:ConfigValue
得到该配置的设定值(即读取到的值)。
若初始化时未写入默认值,则可以通过ConfigValue.getOrDefault()
方法在该设定值为空时获取默认值。- Specified by:
get
in classConfigValue<java.util.Map<K,V>>
- Returns:
- 设定值
-
getNotNull
public V getNotNull(java.lang.Object key)
-
set
public void set(@Nullable @Nullable java.util.Map<K,V> value)
Description copied from class:ConfigValue
设定该配置的值。
设定后,不会自动保存配置文件;若需要保存,请调用ConfigurationProvider.save()
方法。- Specified by:
set
in classConfigValue<java.util.Map<K,V>>
- Parameters:
value
- 配置的值
-
modifyValue
@NotNull public <T> T modifyValue(java.util.function.Function<java.util.Map<K,V>,T> function)
-
modifyMap
@NotNull public @NotNull java.util.Map<K,V> modifyMap(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()
-
-