| Constructor and Description |
|---|
Conf() |
| Modifier and Type | Method and Description |
|---|---|
void |
addIniConfig(File iniFile) |
void |
addJsonConfig(File jsonFile) |
void |
addMapConfig(Map<String,Object> mapConfig) |
void |
addPropertiesConfig(File propertiesFile) |
void |
addPropertiesConfig(Properties propertiesConfig) |
void |
addResource(Resource resource)
Load the resource name and content in one step.
|
void |
addXmlConfig(File xmlFile) |
Boolean |
getBoolean(ConfigKey name,
boolean useDefault) |
Boolean |
getBoolean(String name) |
Boolean |
getBoolean(String name,
Boolean defaultValue) |
Class<?> |
getClass(ConfigKey name,
boolean useDefault) |
Class<?> |
getClass(String name) |
Class<?> |
getClass(String name,
Class<?> defaultValue) |
Config |
getConfig(ConfigKey name) |
Config |
getConfig(String name) |
Float |
getFloat(ConfigKey name,
boolean useDefault) |
Float |
getFloat(String name) |
Float |
getFloat(String name,
Float defaultValue) |
<T> T |
getInstance(ConfigKey name) |
<T> T |
getInstance(String name) |
<T> T |
getInstance(String name,
Class<T> xface) |
Integer |
getInt(ConfigKey name,
boolean useDefault) |
Integer |
getInt(String name) |
Integer |
getInt(String name,
Integer defaultValue) |
List<String> |
getList(ConfigKey name) |
List<String> |
getList(String name) |
List<String> |
getList(String name,
String[] defaultValue) |
Long |
getLong(ConfigKey name,
boolean useDefault) |
Long |
getLong(String name) |
Long |
getLong(String name,
Long defaultValue) |
Set<String> |
getNames() |
String |
getResource() |
String |
getString(ConfigKey name,
boolean useDefault) |
String |
getString(String name) |
String |
getString(String name,
String defaultValue) |
String |
getTrimmed(ConfigKey name) |
String |
getTrimmed(String name) |
void |
reload()
For users usage, to determine whether to reload config files.
|
void |
setBoolean(ConfigKey name,
Boolean value)
Set a boolean value for the specified property
|
void |
setBoolean(String name,
Boolean value)
Set a boolean value for the specified property
|
void |
setFloat(ConfigKey name,
Float value)
Set a float value for the specified property
|
void |
setFloat(String name,
Float value)
Set a float value for the specified property
|
void |
setInt(ConfigKey name,
Integer value)
Set an int value for the specified property
|
void |
setInt(String name,
Integer value)
Set an int value for the specified property
|
void |
setLong(ConfigKey name,
Long value)
Set a long value for the specified property
|
void |
setLong(String name,
Long value)
Set a long value for the specified property
|
void |
setString(ConfigKey name,
String value)
Set a string value for the specified property
|
void |
setString(String name,
String value)
Values user sets will be add in config directly.
|
public void addXmlConfig(File xmlFile) throws IOException
IOExceptionpublic void addIniConfig(File iniFile) throws IOException
IOExceptionpublic void addJsonConfig(File jsonFile) throws IOException
IOExceptionpublic void addPropertiesConfig(File propertiesFile) throws IOException
IOExceptionpublic void addPropertiesConfig(Properties propertiesConfig)
public void addResource(Resource resource)
resource - the config resourcepublic void reload()
public String getResource()
getResource in interface Configpublic void setString(String name, String value)
public void setString(ConfigKey name, String value)
Configpublic String getTrimmed(String name)
getTrimmed in interface Configpublic String getTrimmed(ConfigKey name)
getTrimmed in interface Configpublic Boolean getBoolean(String name)
getBoolean in interface Configpublic Boolean getBoolean(ConfigKey name, boolean useDefault)
getBoolean in interface Configpublic Boolean getBoolean(String name, Boolean defaultValue)
getBoolean in interface Configpublic void setBoolean(String name, Boolean value)
ConfigsetBoolean in interface Configname - The property namevalue - The boolean valuepublic void setBoolean(ConfigKey name, Boolean value)
ConfigsetBoolean in interface Configname - The config key namevalue - The boolean valuepublic void setInt(String name, Integer value)
Configpublic void setInt(ConfigKey name, Integer value)
Configpublic void setLong(String name, Long value)
Configpublic void setLong(ConfigKey name, Long value)
Configpublic void setFloat(String name, Float value)
Configpublic void setFloat(ConfigKey name, Float value)
Configpublic Class<?> getClass(String name) throws ClassNotFoundException
getClass in interface ConfigClassNotFoundExceptionpublic Class<?> getClass(String name, Class<?> defaultValue) throws ClassNotFoundException
getClass in interface ConfigClassNotFoundExceptionpublic Class<?> getClass(ConfigKey name, boolean useDefault) throws ClassNotFoundException
getClass in interface ConfigClassNotFoundExceptionpublic <T> T getInstance(String name) throws ClassNotFoundException
getInstance in interface ConfigClassNotFoundExceptionpublic <T> T getInstance(ConfigKey name) throws ClassNotFoundException
getInstance in interface ConfigClassNotFoundExceptionpublic <T> T getInstance(String name, Class<T> xface) throws ClassNotFoundException
getInstance in interface ConfigClassNotFoundExceptionCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.