接口 ConfigurationService
-
- 所有超级接口:
Serializable,Service
- 所有已知实现类:
ConfigurationServiceImpl
public interface ConfigurationService extends Service
Provides access to the initial user-provided configuration values. Generally speaking these values come from:- 作者:
- Steve Ebersole
-
-
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static interfaceConfigurationService.Converter<T>Simple conversion contract for converting an untyped object to a specified type.
-
方法概要
所有方法 实例方法 抽象方法 已过时的方法 修饰符和类型 方法 说明 <T> Tcast(Class<T> expected, Object candidate)已过时。No idea why this is exposed here...<T> TgetSetting(String name, Class<T> expected, T defaultValue)Get the named setting.<T> TgetSetting(String name, ConfigurationService.Converter<T> converter)Get the named setting, using the specified converter.<T> TgetSetting(String name, ConfigurationService.Converter<T> converter, T defaultValue)Get the named setting, using the specified converter and default value.MapgetSettings()Access to the complete map of config settings.
-
-
-
方法详细资料
-
getSettings
Map getSettings()
Access to the complete map of config settings. The returned map is immutable- 返回:
- The immutable map of config settings.
-
getSetting
<T> T getSetting(String name, ConfigurationService.Converter<T> converter)
Get the named setting, using the specified converter.- 类型参数:
T- The Java type of the conversion- 参数:
name- The name of the setting to get.converter- The converter to apply- 返回:
- The converted (typed) setting. May return
null(seegetSetting(String, Class, Object))
-
getSetting
<T> T getSetting(String name, ConfigurationService.Converter<T> converter, T defaultValue)
Get the named setting, using the specified converter and default value.- 类型参数:
T- The Java type of the conversion- 参数:
name- The name of the setting to get.converter- The converter to applydefaultValue- If no setting with that name is found, return this default value as the result.- 返回:
- The converted (typed) setting. Will be the defaultValue if no such setting was defined.
-
getSetting
<T> T getSetting(String name, Class<T> expected, T defaultValue)
Get the named setting. Differs from the form taking a Converter in that here we expect to have a simple cast rather than any involved conversion.- 类型参数:
T- The Java type of the conversion- 参数:
name- The name of the setting to get.expected- The expected Java type.defaultValue- If no setting with that name is found, return this default value as the result.- 返回:
- The converted (typed) setting. Will be the defaultValue if no such setting was defined.
-
cast
@Deprecated <T> T cast(Class<T> expected, Object candidate)
已过时。No idea why this is exposed here...Cast candidate to the instance of expected type.- 类型参数:
T- The java type of the expected return- 参数:
expected- The type of instance expected to return.candidate- The candidate object to be casted.- 返回:
- The instance of expected type or null if this cast fail.
-
-