Class ConfiguredValue<V>
java.lang.Object
cc.carm.lib.configuration.value.ValueManifest<V,V>
cc.carm.lib.configuration.value.ConfigValue<V,V>
cc.carm.lib.configuration.value.impl.CachedConfigValue<V,V>
cc.carm.lib.configuration.value.standard.ConfiguredValue<V>
-
Field Summary
FieldsFields 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, validator
-
Constructor Summary
ConstructorsConstructorDescriptionConfiguredValue
(@NotNull ValueManifest<V, V> manifest, @NotNull ValueAdapter<V> adapter) -
Method Summary
Modifier and TypeMethodDescription@NotNull ValueAdapter
<V> adapter()
static <V> ConfigValueBuilder
<V> Create a new value builder.static <V> ConfigValueBuilder
<V> Create a new value builder.get()
Gets the configured value (i.e., the value read from the source).static <V> ConfiguredValue
<V> static <V> ConfiguredValue
<V> static <V> ConfiguredValue
<V> of
(@NotNull ValueManifest<V, V> manifest, @NotNull ValueAdapter<V> adapter) static <V> ConfiguredValue
<V> of
(@NotNull ValueManifest<V, V> manifest, @Nullable ValueParser<V> parser, @Nullable ValueSerializer<V> serializer) static <V> ConfiguredValue
<V> static <V> ConfiguredValue
<V> static <V> ConfiguredValue
<V> static <V> ConfiguredValue
<V> of
(V defaults) @Nullable ValueParser
<V> parser()
@Nullable ValueSerializer
<V> void
Set the value of the configuration path.static <V> SourceValueBuilder
<V, V> Create a new value builder with the specifiedConfigurationHolder.registeredValues()
type.static <V> SourceValueBuilder
<V, V> Create a new value builder with the specifiedConfigurationHolder.registeredValues()
type.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, throwing, throwing, type, validate, validator, validator, withValidated
-
Field Details
-
adapter
-
-
Constructor Details
-
ConfiguredValue
public ConfiguredValue(@NotNull @NotNull ValueManifest<V, V> manifest, @NotNull @NotNull ValueAdapter<V> adapter)
-
-
Method Details
-
builderOf
Create a new value builder.- Type Parameters:
V
- The type of the value.- Parameters:
type
- The type of the value.- Returns:
- a
ConfigValueBuilder
with the specified type.
-
builderOf
Create a new value builder.- Type Parameters:
V
- The type of the value.- Parameters:
type
- The type of the value.- Returns:
- a
ConfigValueBuilder
with the specified type.
-
with
Create a new value builder with the specifiedConfigurationHolder.registeredValues()
type.- Type Parameters:
V
- The type of the value.- Parameters:
registeredType
- The type of the value.- Returns:
- a
SourceValueBuilder
with the specified registered type. - See Also:
-
with
Create a new value builder with the specifiedConfigurationHolder.registeredValues()
type.- Type Parameters:
V
- The type of the value.- Parameters:
registeredType
- The type of the value.- Returns:
- a
SourceValueBuilder
with the specified registered type. - See Also:
-
of
-
of
-
of
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull Class<V> type, @NotNull @NotNull Supplier<@Nullable V> defaultSupplier) -
of
-
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueType<V> type, @NotNull @NotNull Supplier<@Nullable V> defaultSupplier) -
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueManifest<V, V> manifest, @Nullable @Nullable ValueParser<V> parser, @Nullable @Nullable ValueSerializer<V> serializer) -
of
public static <V> ConfiguredValue<V> of(@NotNull @NotNull ValueManifest<V, V> manifest, @NotNull @NotNull ValueAdapter<V> adapter) -
adapter
- Returns:
- Adapter of this value.
-
parser
- Returns:
- Value's parser, parse base object to value.
-
serializer
- Returns:
- Value's serializer, parse value to base object.
-
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,
V> - Returns:
- Configured value
-
set
Set the value of the configuration path. Will useserializer()
to serialize the value.- Specified by:
set
in classConfigValue<V,
V> - Parameters:
value
- The value to be set
-