Class ConfigurationGroup
java.lang.Object
de.gurkenlabs.litiengine.configuration.ConfigurationGroup
- Direct Known Subclasses:
ClientConfiguration,DebugConfiguration,GraphicConfiguration,InputConfiguration,SoundConfiguration
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 ClassesModifier and TypeClassDescriptionstatic interfaceThis listener interface receives events when any property of the configuration changed. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInitializes a new instance of theConfigurationGroupclass. -
Method Summary
Modifier and TypeMethodDescriptionGets the prefix.protected voidinitializeByProperty(String key, String value) Initialize by property.booleanisDebug()voidAdds the specified configuration changed listener to receive events about any configuration property that changed.voidprotected <T> voidUse this method to set configuration properties if you want to supportconfigurationChangedfor your property.voidsetDebug(boolean debug) protected voidstoreProperties(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:
-
removeListener
-
getPrefix
Gets the prefix.- Returns:
- the prefix
-
isDebug
public boolean isDebug() -
setDebug
public void setDebug(boolean debug) -
initializeByProperty
Initialize by property.- Parameters:
key- the keyvalue- the value
-
storeProperties
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
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.
-