Package com.tenio.common.configuration
Interface Configuration
- All Known Implementing Classes:
CommonConfiguration
public interface 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.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all configurations.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.void
Load the configuration by configured files.toString()
Retrieves readable text.
-
Method Details
-
load
Load the configuration by configured files.- Parameters:
file
- the configuration file- Throws:
Exception
- something went wrong on parsing the configuration file
-
getBoolean
Retrieves the value by key.- Parameters:
key
- the configuration's key- Returns:
- the value in
Boolean
-
getInt
Retrieves the value by key.- Parameters:
key
- the configuration's key- Returns:
- the value in
Integer
-
getFloat
Retrieves the value by key.- Parameters:
key
- the configuration's key- Returns:
- the value in
Float
-
getString
Retrieves the value by key.- Parameters:
key
- the configuration's key- Returns:
- the value in
String
-
get
Retrieves the value by key.- Parameters:
key
- the configuration's key- Returns:
- the value in
Object
-
isDefined
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".- Parameters:
key
- The desired configuration's key- Returns:
- true if the configuration is defined, otherwise return false
-
toString
String toString()Retrieves readable text. -
clear
void clear()Remove all configurations.
-