User Tools

Site Tools


DzSettingsHelper

Convenience object to make working with DzAppSettings even easier.

More...

Inherits :

Constructors

DAZ Script
DzSettingsHelper ()

Methods

DAZ Script
Objectget ( String path, String name, Object value )
BooleanhasValue ( String path, String name )
BooleanremoveValue ( String path, String name )
voidset ( String path, String name, Object value )

Detailed Description

Choosing the appropriate key type and pushing/popping keys (paths) is handled by the object.

Constructors


DzSettingsHelper()

Default Constructor

Methods


Object : get( String path, String name, Object value )

Retrieves a value from the subkey at the given key.

Parameter(s):

  • path - The path of the key to retrieve the named value from; similar to a folder in the file system
  • name - The name of the value to retrieve; the “key” in a key/value pair
  • value - The default value to return if the name is not found; the “value” in a key/value pair

Return Value:

  • The object that represents the value at the specified path/name

Example:

var oSettingsHelper = new DzSettingsHelper();
var bResult = oSettingsHelper.get( "MyCompany/MyToolName", "MyKey", false );
print( bResult );

Boolean : hasValue( String path, String name )

Retrieves whether a value exists at the given key.

Parameter(s):

  • path - The path of the key to check for its existence; similar to a folder in the file system
  • name - The name of the value to check for its existence; the “key” in a key/value pair

Return Value:

  • true if path/key exists, otherwise false.

Example:

var oSettingsHelper = new DzSettingsHelper();
var bResult = oSettingsHelper.hasValue( "MyCompany/MyToolName", "MyKey" );
print( bResult );

Boolean : removeValue( String path, String name )

Removes a named value at the given path.

Parameter(s):

  • path - The path of the key to remove; similar to a folder in the file system
  • name - The name of the value to remove; the “key” in a key/value pair

Return Value:

  • true if path/key exists, otherwise false.

Example:

var oSettingsHelper = new DzSettingsHelper();
var bResult = oSettingsHelper.removeValue( "MyCompany/MyToolName", "MyKey" );
print( bResult );

Since:

  • 4.9.0.38

void : set( String path, String name, Object value )

Records a named value to the path specified.

Parameter(s):

  • path - The path of the key to place the named value at; similar to a folder in the file system
  • name - The name of the value to record; the “key” in a key/value pair
  • value - The value to record; i.e. a Number, String, Boolean or Color; the “value” in a key/value pair

Example:

var oSettingsHelper = new DzSettingsHelper();
oSettingsHelper.set( "MyCompany/MyToolName", "MyKey", true );