Class ConfiguredValue<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<V>
-
- cc.carm.lib.configuration.value.standard.ConfiguredValue<V>
-
public class ConfiguredValue<V> extends CachedConfigValue<V>
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull ValueAdapter<V>
adapter
-
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 ConfiguredValue(@NotNull ValueManifest<V> manifest, @NotNull ValueAdapter<V> adapter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ValueAdapter<V>
adapter()
static <V> ConfigValueBuilder<V>
builderOf(@NotNull ValueType<V> type)
static <V> ConfigValueBuilder<V>
builderOf(@NotNull java.lang.Class<V> type)
V
get()
Gets the configured value (i.e., the value read from the source).static <V> ConfiguredValue<V>
of(@NotNull ValueType<V> type)
static <V> ConfiguredValue<V>
of(@NotNull ValueType<V> type, @NotNull java.util.function.Supplier<@Nullable V> defaultSupplier)
static <V> ConfiguredValue<V>
of(@NotNull ValueManifest<V> manifest, @NotNull ValueAdapter<V> adapter)
static <V> ConfiguredValue<V>
of(@NotNull ValueManifest<V> manifest, @Nullable ValueParser<V> parser, @Nullable ValueSerializer<V> serializer)
static <V> ConfiguredValue<V>
of(@NotNull java.lang.Class<V> type)
static <V> ConfiguredValue<V>
of(@NotNull java.lang.Class<V> type, @NotNull java.util.function.Supplier<@Nullable V> defaultSupplier)
static <V> ConfiguredValue<V>
of(@NotNull java.lang.Class<V> type, V defaults)
static <V> ConfiguredValue<V>
of(V defaults)
@Nullable ValueParser<V>
parser()
@Nullable ValueSerializer<V>
serializer()
void
set(V value)
Set the value of the configuration path.-
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
-
adapter
@NotNull protected final @NotNull ValueAdapter<V> adapter
-
-
Constructor Detail
-
ConfiguredValue
public ConfiguredValue(@NotNull @NotNull ValueManifest<V> manifest, @NotNull @NotNull ValueAdapter<V> adapter)
-
-
Method Detail
-
builderOf
public static <V> ConfigValueBuilder<V> builderOf(@NotNull @NotNull java.lang.Class<V> type)
-
builderOf
public static <V> ConfigValueBuilder<V> builderOf(@NotNull @NotNull ValueType<V> type)
-
of
public static <V> ConfiguredValue<V> of(@NotNull V defaults)
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull java.lang.Class<V> type)
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull java.lang.Class<V> type, @NotNull V defaults)
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull java.lang.Class<V> type, @NotNull @NotNull java.util.function.Supplier<@Nullable V> defaultSupplier)
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueType<V> type)
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueType<V> type, @NotNull @NotNull java.util.function.Supplier<@Nullable V> defaultSupplier)
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueManifest<V> manifest, @Nullable @Nullable ValueParser<V> parser, @Nullable @Nullable ValueSerializer<V> serializer)
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueManifest<V> manifest, @NotNull @NotNull ValueAdapter<V> adapter)
-
adapter
@NotNull public @NotNull ValueAdapter<V> adapter()
- Returns:
- Adapter of this value.
-
parser
@Nullable public @Nullable ValueParser<V> parser()
- Returns:
- Value's parser, parse base object to value.
-
serializer
@Nullable public @Nullable ValueSerializer<V> serializer()
- Returns:
- Value's serializer, parse value to base object.
-
get
public V get()
Description copied from class:ConfigValue
Gets 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:
get
in classConfigValue<V>
- Returns:
- Configured value
-
set
public void set(V value)
Set the value of the configuration path. Will useserializer()
to serialize the value.- Specified by:
set
in classConfigValue<V>
- Parameters:
value
- The value to be set
-
-