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.ObjectThis 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 Type Class Description static interfaceConfigurationGroup.ConfigurationChangedListenerThis listener interface receives events when any property of the configuration changed.Constructor Summary
Constructors Modifier Constructor Description protectedConfigurationGroup()Initializes a new instance of theConfigurationGroupclass.Method Summary
Modifier and Type Method Description 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 supportconfigurationChangedfor your property.voidsetDebug(boolean debug)protected voidstoreProperties(java.util.Properties properties)Store properties.
Constructor Details
ConfigurationGroup
protected ConfigurationGroup()Initializes a new instance of theConfigurationGroupclass.
Method Details
onChanged
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
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 keyvalue- 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 supportconfigurationChangedfor 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.
