接口 Configuration
-
- 所有已知子接口:
DynamicConfiguration
- 所有已知实现类:
AbstractDynamicConfiguration,CompositeConfiguration,CompositeDynamicConfiguration,ConfigConfigurationAdapter,EnvironmentConfiguration,FileSystemDynamicConfiguration,InmemoryConfiguration,NopDynamicConfiguration,PropertiesConfiguration,SystemConfiguration,TreePathDynamicConfiguration
public interface ConfigurationConfiguration interface, to fetch the value for the specified key.
-
-
方法概要
所有方法 静态方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default booleancontainsKey(String key)Check if the configuration contains the specified key.default <T> Tconvert(Class<T> cls, String key, T defaultValue)default booleangetBoolean(String key)default booleangetBoolean(String key, boolean defaultValue)default BooleangetBoolean(String key, Boolean defaultValue)default intgetInt(String key)default intgetInt(String key, int defaultValue)default IntegergetInteger(String key, Integer defaultValue)ObjectgetInternalProperty(String key)default ObjectgetProperty(String key)Gets a property from the configuration.default ObjectgetProperty(String key, Object defaultValue)Gets a property from the configuration.default StringgetString(String key)Get a string associated with the given configuration key.default StringgetString(String key, String defaultValue)Get a string associated with the given configuration key.static BooleantoBooleanObject(boolean bool)
-
-
-
方法详细资料
-
getString
default String getString(String key)
Get a string associated with the given configuration key.- 参数:
key- The configuration key.- 返回:
- The associated string.
-
getString
default String getString(String key, String defaultValue)
Get a string associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- 参数:
key- The configuration key.defaultValue- The default value.- 返回:
- The associated string if key is found and has valid format, default value otherwise.
-
getInt
default int getInt(String key)
-
getInt
default int getInt(String key, int defaultValue)
-
getBoolean
default boolean getBoolean(String key)
-
getBoolean
default boolean getBoolean(String key, boolean defaultValue)
-
getProperty
default Object getProperty(String key)
Gets a property from the configuration. This is the most basic get method for retrieving values of properties. In a typical implementation of theConfigurationinterface the other get methods (that return specific data types) will internally make use of this method. On this level variable substitution is not yet performed. The returned object is an internal representation of the property value for the passed in key. It is owned by theConfigurationobject. So a caller should not modify this object. It cannot be guaranteed that this object will stay constant over time (i.e. further update operations on the configuration may change its internal state).- 参数:
key- property to retrieve- 返回:
- the value to which this configuration maps the specified key, or null if the configuration contains no mapping for this key.
-
getProperty
default Object getProperty(String key, Object defaultValue)
Gets a property from the configuration. The default value will return if the configuration doesn't contain the mapping for the specified key.- 参数:
key- property to retrievedefaultValue- default value- 返回:
- the value to which this configuration maps the specified key, or default value if the configuration contains no mapping for this key.
-
containsKey
default boolean containsKey(String key)
Check if the configuration contains the specified key.- 参数:
key- the key whose presence in this configuration is to be tested- 返回:
trueif the configuration contains a value for this key,falseotherwise
-
toBooleanObject
static Boolean toBooleanObject(boolean bool)
-
-