Package com.tenio.common.configuration
Class CommonConfiguration
java.lang.Object
com.tenio.common.logger.AbstractLogger
com.tenio.common.logger.SystemLogger
com.tenio.common.configuration.CommonConfiguration
- All Implemented Interfaces:
Configuration
This server needs some basic configuration to start running. The
configuration file can be defined as an XML file. See an example in
configuration.example.xml. You can also extend this file to create your own
configuration values.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all configurations.protected abstract void
Your extension part can be handled here.get
(ConfigurationType key) Retrieves the value by key.boolean
Retrieves the value by key.float
Retrieves the value by key.int
getInt
(ConfigurationType key) Retrieves the value by key.Retrieves the value by key.boolean
Determine if this configuration is existed or defined.protected void
push
(ConfigurationType key, Object value) Put a new configuration.toString()
Retrieves readable text.Methods inherited from class com.tenio.common.logger.SystemLogger
debug, trace, trace
Methods inherited from class com.tenio.common.logger.AbstractLogger
buildgen, error, error, info, info, info, info, info, info, info, info
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.tenio.common.configuration.Configuration
load
-
Constructor Details
-
CommonConfiguration
public CommonConfiguration()
-
-
Method Details
-
getBoolean
Description copied from interface:Configuration
Retrieves the value by key.- Specified by:
getBoolean
in interfaceConfiguration
- Parameters:
key
- the configuration's key- Returns:
- the value in
Boolean
-
getInt
Description copied from interface:Configuration
Retrieves the value by key.- Specified by:
getInt
in interfaceConfiguration
- Parameters:
key
- the configuration's key- Returns:
- the value in
Integer
-
getFloat
Description copied from interface:Configuration
Retrieves the value by key.- Specified by:
getFloat
in interfaceConfiguration
- Parameters:
key
- the configuration's key- Returns:
- the value in
Float
-
getString
Description copied from interface:Configuration
Retrieves the value by key.- Specified by:
getString
in interfaceConfiguration
- Parameters:
key
- the configuration's key- Returns:
- the value in
String
-
get
Description copied from interface:Configuration
Retrieves the value by key.- Specified by:
get
in interfaceConfiguration
- Parameters:
key
- the configuration's key- Returns:
- the value in
Object
-
isDefined
Description copied from interface:Configuration
Determine if this configuration is existed or defined. If you want some configuration value to be treated as an "undefined" status, let its value "-1".- Specified by:
isDefined
in interfaceConfiguration
- Parameters:
key
- The desired configuration's key- Returns:
- true if the configuration is defined, otherwise return false
-
toString
Description copied from interface:Configuration
Retrieves readable text.- Specified by:
toString
in interfaceConfiguration
- Overrides:
toString
in classObject
- Returns:
- configuration information as human-readable data
-
clear
public void clear()Description copied from interface:Configuration
Remove all configurations.- Specified by:
clear
in interfaceConfiguration
-
push
Put a new configuration.- Parameters:
key
- keyvalue
- value
-
extend
Your extension part can be handled here. Check the examples for more details about how to use it.- Parameters:
extProperties
- the extension data in key-value format (seeMap
)
-