| Package | de.mightypirates.utils.interfaces |
| Interface | public interface ISettings |
| Implementors | Settings |
Settings class.
| Property | Defined by | ||
|---|---|---|---|
| useSharedObject : Boolean
Whether to use of the shared object for this instance.
| ISettings | ||
| Method | Defined by | ||
|---|---|---|---|
|
getSetting(name:String):*
Get the current value of a setting.
| ISettings | ||
|
getSoSetting(name:String, def:* = null):*
Retrieve a value from the
SharedObject associated to these
settings. | ISettings | ||
|
isRegistered(name:String):Boolean
Checks if a setting with the given name is registered.
| ISettings | ||
|
register(name:String, defaultValue:uint = null, validator:* = null, priority:* = 20):void
Register a setting.
| ISettings | ||
|
registerAlias(name:String, setting:String):void
Registers an alias for a setting, allowing access to the setting through
the alias name.
| ISettings | ||
|
setSetting(name:String, value:*):void
Change the value of a setting.
| ISettings | ||
|
setSoSetting(name:String, value:*):void
Store a value in the
SharedObject associated to these
settings. | ISettings | ||
| useSharedObject | property |
useSharedObject:Boolean [read-write]Whether to use of the shared object for this instance.
Implementation public function get useSharedObject():Boolean
public function set useSharedObject(value:Boolean):void
| getSetting | () | method |
public function getSetting(name:String):*Get the current value of a setting.
Parametersname:String — the name of the setting.
|
* |
— exception if the setting is not registered.
|
| getSoSetting | () | method |
public function getSoSetting(name:String, def:* = null):*
Retrieve a value from the SharedObject associated to these
settings.
name:String — the name of the setting.
|
|
def:* (default = null) — a default value to return if the setting is not set in the
shared object.
|
* |
| isRegistered | () | method |
public function isRegistered(name:String):BooleanChecks if a setting with the given name is registered.
Parametersname:String — the setting to check for existance.
|
Boolean — true if the setting is registered, else false.
|
| register | () | method |
public function register(name:String, defaultValue:uint = null, validator:* = null, priority:* = 20):voidRegister a setting. Will be initialized to the default value.
It is assumed that the default value is valid [1], but the value is sent through the validator once, nonetheless, to allow it to perform any other actions it would when getting a new setting (to avoid having to write additional initializations).
[1] valid in the sense of not being null,
undefined or of an invalid type. If the default value does
not fit into the bounds enforced by the validator it will be adjusted
accordingly.
name:String — the name of the setting to register.
|
|
defaultValue:uint (default = null) — the default value for that setting.
|
|
validator:* (default = null) — the validator to use for that setting. If not given, it is
tried to find a default validator for the defaultValue. This
is possible for "boolean", "number" and "string". Because
"int" and "uint" get evaluated as "number", it is possible to
use those types as a shortcut by passing them as the
validator parameter, i.e. you could e.g. use:settings.register("some.setting", 4, uint);instead of the long settings.register("some.setting", 4, Validation.validateUInt);
|
|
priority:* (default = 20) — the value's priority when parsing settings from xml
definitions. Settings with lower numbers get parsed first.
|
| registerAlias | () | method |
public function registerAlias(name:String, setting:String):voidRegisters an alias for a setting, allowing access to the setting through the alias name.
Parametersname:String — the name of the alias to register.
|
|
setting:String — the name of the actual setting the alias should forward to.
|
| setSetting | () | method |
public function setSetting(name:String, value:*):voidChange the value of a setting. If a validator is set for that setting it will be used to check the new value before setting it.
Parametersname:String — the name of the setting to change.
|
|
value:* — the new value for the setting.
|
— exception if the setting is not registered.
|
| setSoSetting | () | method |
public function setSoSetting(name:String, value:*):void
Store a value in the SharedObject associated to these
settings.
name:String — the name of the setting to store.
|
|
value:* — the value for the setting.
|