Class CommonConfiguration

All Implemented Interfaces:
Configuration

public abstract class CommonConfiguration extends SystemLogger implements 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 Details

    • CommonConfiguration

      public CommonConfiguration()
  • Method Details

    • getBoolean

      public boolean getBoolean(ConfigurationType key)
      Description copied from interface: Configuration
      Retrieves the value by key.
      Specified by:
      getBoolean in interface Configuration
      Parameters:
      key - the configuration's key
      Returns:
      the value in Boolean
    • getInt

      public int getInt(ConfigurationType key)
      Description copied from interface: Configuration
      Retrieves the value by key.
      Specified by:
      getInt in interface Configuration
      Parameters:
      key - the configuration's key
      Returns:
      the value in Integer
    • getFloat

      public float getFloat(ConfigurationType key)
      Description copied from interface: Configuration
      Retrieves the value by key.
      Specified by:
      getFloat in interface Configuration
      Parameters:
      key - the configuration's key
      Returns:
      the value in Float
    • getString

      public String getString(ConfigurationType key)
      Description copied from interface: Configuration
      Retrieves the value by key.
      Specified by:
      getString in interface Configuration
      Parameters:
      key - the configuration's key
      Returns:
      the value in String
    • get

      public Object get(ConfigurationType key)
      Description copied from interface: Configuration
      Retrieves the value by key.
      Specified by:
      get in interface Configuration
      Parameters:
      key - the configuration's key
      Returns:
      the value in Object
    • isDefined

      public boolean isDefined(ConfigurationType key)
      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 interface Configuration
      Parameters:
      key - The desired configuration's key
      Returns:
      true if the configuration is defined, otherwise return false
    • toString

      public String toString()
      Description copied from interface: Configuration
      Retrieves readable text.
      Specified by:
      toString in interface Configuration
      Overrides:
      toString in class Object
      Returns:
      configuration information as human-readable data
    • clear

      public void clear()
      Description copied from interface: Configuration
      Remove all configurations.
      Specified by:
      clear in interface Configuration
    • push

      protected void push(ConfigurationType key, Object value)
      Put a new configuration.
      Parameters:
      key - key
      value - value
    • extend

      protected abstract void extend(Map<String,String> extProperties)
      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 (see Map)