Class ConfigurationGroup

java.lang.Object
de.gurkenlabs.litiengine.configuration.ConfigurationGroup
Direct Known Subclasses:
ClientConfiguration, DebugConfiguration, GraphicConfiguration, InputConfiguration, SoundConfiguration

public abstract class ConfigurationGroup
extends java.lang.Object
This class contains some basic functionality for all setting groups. It gets the SettingsGroupInfo annotation and reads out the prefix that is used when reading/ writing the settings into a property file.
  • Nested Class Summary

    Nested Classes 
    Modifier and TypeClassDescription
    static interface ConfigurationGroup.ConfigurationChangedListener
    This listener interface receives events when any property of the configuration changed.
  • Constructor Summary

    Constructors 
    ModifierConstructorDescription
    protected ConfigurationGroup()
    Initializes a new instance of the ConfigurationGroup class.
  • Method Summary

    Modifier and TypeMethodDescription
    java.lang.StringgetPrefix()
    Gets the prefix.
    protected voidinitializeByProperty​(java.lang.String key, java.lang.String value)
    Initialize by property.
    booleanisDebug() 
    voidonChanged​(ConfigurationGroup.ConfigurationChangedListener listener)
    Adds the specified configuration changed listener to receive events about any configuration property that changed.
    voidremoveListener​(ConfigurationGroup.ConfigurationChangedListener listener) 
    protected <T> voidset​(java.lang.String fieldName, T value)
    Use this method to set configuration properties if you want to support configurationChanged for your property.
    voidsetDebug​(boolean debug) 
    protected voidstoreProperties​(java.util.Properties properties)
    Store properties.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfigurationGroup

      protected ConfigurationGroup()
      Initializes a new instance of the ConfigurationGroup class.
  • Method Details

    • onChanged

      public void onChanged​(ConfigurationGroup.ConfigurationChangedListener listener)
      Adds the specified configuration changed listener to receive events about any configuration property that changed.

      The event is supported for any property that uses the set(String, Object) method to set the field value.

      The event will provide you with the fieldName of the called setter (e.g. "debug" for the "setDebug" call).

      Parameters:
      listener - The listener to add.
      See Also:
      set(String, Object)
    • removeListener

      public void removeListener​(ConfigurationGroup.ConfigurationChangedListener listener)
    • getPrefix

      public java.lang.String getPrefix()
      Gets the prefix.
      Returns:
      the prefix
    • isDebug

      public boolean isDebug()
    • setDebug

      public void setDebug​(boolean debug)
    • initializeByProperty

      protected void initializeByProperty​(java.lang.String key, java.lang.String value)
      Initialize by property.
      Parameters:
      key - the key
      value - the value
    • storeProperties

      protected void storeProperties​(java.util.Properties properties)
      Store properties. By default, it is supported to store the following types: boolean, int, double, float, String and enum values. If you need to store any other object, you should overwrite this method as well as the initializeProperty method and implement a custom approach.
      Parameters:
      properties - the properties
    • set

      protected <T> void set​(java.lang.String fieldName, T value)
      Use this method to set configuration properties if you want to support configurationChanged for your property.
      Type Parameters:
      T - The type of the value to set.
      Parameters:
      fieldName - The name of the field to set.
      value - The value to set.