Class ConfigurationMetaHolder
- java.lang.Object
-
- cc.carm.lib.configuration.source.meta.ConfigurationMetaHolder
-
public class ConfigurationMetaHolder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected @NotNull java.util.Map<ConfigurationMetadata<?>,java.lang.Object>
values
-
Constructor Summary
Constructors Constructor Description ConfigurationMetaHolder()
ConfigurationMetaHolder(@NotNull java.util.Map<ConfigurationMetadata<?>,java.lang.Object> values)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(@NotNull ConfigurationMetadata<?> type)
<V> V
get(@NotNull ConfigurationMetadata<V> type)
Get the value of option.<V> V
get(@NotNull ConfigurationMetadata<V> type, java.util.function.Supplier<@Nullable V> defaultValue)
Get the value of option.<V> V
get(@NotNull ConfigurationMetadata<V> type, V defaultValue)
Get the value of option.<V> V
set(@NotNull ConfigurationMetadata<V> type, V value)
Set the value of meta, if the value is null, the meta will be removed.<V> void
setIfAbsent(@NotNull ConfigurationMetadata<V> type, V value)
Set the value of meta, if the value is null, the meta will not be changed.<V> V
setIfPresent(@NotNull ConfigurationMetadata<V> type, V value)
Set the value of meta, if the value is null, the meta will not be changed.@NotNull java.util.Map<ConfigurationMetadata<?>,java.lang.Object>
values()
-
-
-
Field Detail
-
values
@NotNull protected final @NotNull java.util.Map<ConfigurationMetadata<?>,java.lang.Object> values
-
-
Constructor Detail
-
ConfigurationMetaHolder
public ConfigurationMetaHolder()
-
ConfigurationMetaHolder
public ConfigurationMetaHolder(@NotNull @NotNull java.util.Map<ConfigurationMetadata<?>,java.lang.Object> values)
-
-
Method Detail
-
values
@NotNull public @NotNull java.util.Map<ConfigurationMetadata<?>,java.lang.Object> values()
-
get
@Contract("_,!null -> !null") @Nullable public <V> V get(@NotNull @NotNull ConfigurationMetadata<V> type, @Nullable V defaultValue)
Get the value of option.- Type Parameters:
V
- Value type- Parameters:
type
-ConfigurationMetadata
defaultValue
- Default value if the value of option is not set.- Returns:
- Value of option
-
get
@Contract("_,!null -> !null") @Nullable public <V> V get(@NotNull @NotNull ConfigurationMetadata<V> type, java.util.function.Supplier<@Nullable V> defaultValue)
Get the value of option.- Type Parameters:
V
- Value type- Parameters:
type
-ConfigurationMetadata
defaultValue
- Default value if the value of option is not set.- Returns:
- Value of option
-
get
@Nullable public <V> V get(@NotNull @NotNull ConfigurationMetadata<V> type)
Get the value of option.- Type Parameters:
V
- Value type- Parameters:
type
-ConfigurationMetadata
- Returns:
- Value of option
-
contains
public boolean contains(@NotNull @NotNull ConfigurationMetadata<?> type)
-
set
@Nullable public <V> V set(@NotNull @NotNull ConfigurationMetadata<V> type, @Nullable V value)
Set the value of meta, if the value is null, the meta will be removed.
Will only be changed in current holder.- Type Parameters:
V
- Value type- Parameters:
type
-ConfigurationMetadata
value
- Value of meta- Returns:
- Previous value of meta
-
setIfAbsent
public <V> void setIfAbsent(@NotNull @NotNull ConfigurationMetadata<V> type, @Nullable V value)
Set the value of meta, if the value is null, the meta will not be changed.
Will only be changed in current holder.- Type Parameters:
V
- Value type- Parameters:
type
-ConfigurationMetadata
value
- Value of meta
-
setIfPresent
@Nullable public <V> V setIfPresent(@NotNull @NotNull ConfigurationMetadata<V> type, @Nullable V value)
Set the value of meta, if the value is null, the meta will not be changed.
Will only be changed in current holder.- Type Parameters:
V
- Value type- Parameters:
type
-ConfigurationMetadata
value
- Value of meta- Returns:
- Previous value of meta
-
-