Package ai.platon.pulsar.common.config
Class VolatileConfig
-
- All Implemented Interfaces:
public class VolatileConfig extends MutableConfig
Created by vincent on 18-1-17. Copyright @ 2013-2023 Platon AI. All rights reserved.
The volatile config is designed to read/write frequently.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classVolatileConfig.Companion
-
Field Summary
Fields Modifier and Type Field Description private ImmutableConfigfallbackConfigprivate final Map<String, Object>variablesprivate Stringnameprivate final Stringprofileprivate final Stringmodeprivate Environmentenvironmentpublic final static VolatileConfig.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description VolatileConfig()VolatileConfig(Boolean loadDefaults)VolatileConfig(String profile, Boolean loadDefaults, Iterable<String> resources)VolatileConfig(ImmutableConfig fallbackConfig)
-
Method Summary
Modifier and Type Method Description final ImmutableConfiggetFallbackConfig()final UnitsetFallbackConfig(ImmutableConfig fallbackConfig)final Map<String, Object>getVariables()final Unitreset()Stringget(String name, String defaultValue)Get the value of the name.Stringget(String name)Get the value of the nameproperty,nullif no such property exists.final Unitset(String name, String value, Integer ttl)final StringgetAndSet(String name, String value, Integer ttl)final IntegergetTTL(String name)UnitsetTTL(String name, Integer ttl)final <T extends Any> ObjectputBean(T bean)final <T extends Any> ObjectputBean(String name, T bean)final <T extends Any> TgetBeanOrNull(Class<T> bean)final <T extends Any> TgetBeanOrNull(KClass<T> bean)final <T extends Any> TgetBeanOrNull(String name, Class<T> bean)final <T extends Any> TgetBeanOrNull(String name, KClass<T> bean)final <T extends Any> ObjectremoveBean(T bean)final <T extends Any> ObjectremoveBean(String name)final ObjectgetVariable(String name)final UnitsetVariable(String name, Object value)BooleanisExpired(String key)-
Methods inherited from class ai.platon.pulsar.common.config.AbstractConfiguration
getBoolean, getClass, getClass, getConfResourceAsInputStream, getConfResourceAsReader, getDouble, getDuration, getDuration, getEnum, getEnvironment, getFloat, getInstant, getInt, getInts, getKvs, getLong, getMode, getName, getPath, getPathOrNull, getProfile, getResource, getStringCollection, getStrings, getStrings, getTrimmedStringCollection, getTrimmedStrings, getTrimmedStrings, getUint, getUlong, setEnvironment, setName, size, toString, unbox -
Methods inherited from class ai.platon.pulsar.common.config.MutableConfig
clear, getAndSet, getAndUnset, merge, reset, set, setBoolean, setBooleanIfUnset, setDouble, setDuration, setEnum, setFloat, setIfNotEmpty, setIfNotNull, setInstant, setInt, setLong, setStrings, toVolatileConfig, unset -
Methods inherited from class ai.platon.pulsar.common.config.ImmutableConfig
toMutableConfig -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getFallbackConfig
final ImmutableConfig getFallbackConfig()
-
setFallbackConfig
final Unit setFallbackConfig(ImmutableConfig fallbackConfig)
-
getVariables
final Map<String, Object> getVariables()
-
get
String get(String name, String defaultValue)
Get the value of the
name. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not null. If no such property exists, thendefaultValueis returned.- Parameters:
name- property name, will be trimmed before get value.defaultValue- default value.- Returns:
property value, or
defaultValueif the property doesn't exist.
-
get
String get(String name)
Get the value of the
nameproperty,nullif no such property exists.- Parameters:
name- the property name, will be trimmed before get value.- Returns:
the value of the
name, or null if no such property exists.
-
getBeanOrNull
final <T extends Any> T getBeanOrNull(Class<T> bean)
-
getBeanOrNull
final <T extends Any> T getBeanOrNull(KClass<T> bean)
-
removeBean
final <T extends Any> Object removeBean(T bean)
-
removeBean
final <T extends Any> Object removeBean(String name)
-
getVariable
final Object getVariable(String name)
-
setVariable
final Unit setVariable(String name, Object value)
-
-
-
-