Class CachedConfigValue<T,U>
java.lang.Object
cc.carm.lib.configuration.value.ValueManifest<T,U>
cc.carm.lib.configuration.value.ConfigValue<T,U>
cc.carm.lib.configuration.value.impl.CachedConfigValue<T,U>
- Direct Known Subclasses:
ConfiguredList
,ConfiguredMap
,ConfiguredValue
-
Field Summary
FieldsFields inherited from class cc.carm.lib.configuration.value.ValueManifest
defaultSupplier, holder, initializer, path, type, validator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
protected T
Get the cached value or the default value if the cached value is nullprotected T
getCachedOrDefault
(T emptyValue) Get the cached value or the default value if the cached value is nullprotected final T
getDefaultFirst
(T value) protected <O> @Nullable ValueParser
<O> parserFor
(@NotNull ValueAdapter<O> adapter) protected <O> @Nullable ValueSerializer
<O> serializerFor
(@NotNull ValueAdapter<O> adapter) protected T
updateCache
(T value) Methods inherited from class cc.carm.lib.configuration.value.ConfigValue
get, getNotNull, getOrDefault, isDefault, optional, resolve, save, set, 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
-
cachedValue
-
parsedTime
protected long parsedTime
-
-
Constructor Details
-
CachedConfigValue
-
-
Method Details
-
updateCache
-
getCachedValue
-
cacheExpired
public boolean cacheExpired() -
getDefaultFirst
-
getCachedOrDefault
Get the cached value or the default value if the cached value is null- Returns:
- the cached value or the default value
-
getCachedOrDefault
Get the cached value or the default value if the cached value is null- Parameters:
emptyValue
- the value to return if the cached value and the default value are null- Returns:
- the cached value or the default value
-
parserFor
@Nullable protected <O> @Nullable ValueParser<O> parserFor(@NotNull @NotNull ValueAdapter<O> adapter) - Type Parameters:
O
- Base object type- Parameters:
adapter
- Value adapter- Returns:
- Value's parser, parse base object to value.
-
serializerFor
@Nullable protected <O> @Nullable ValueSerializer<O> serializerFor(@NotNull @NotNull ValueAdapter<O> adapter) - Type Parameters:
O
- Base object type- Parameters:
adapter
- Value adapter- Returns:
- Value's serializer, parse value to base object.
-