Settingsable
Direct Subclass:
Indirect Subclass:
Settingsable base class: child classes are able to manage settings.
Example:
Settings are immutable values which define instance initial configuration.
Settings are not intended to act as a mutable state.
API:
set_settings(arg_settings:plain object or Immutable object):nothing - replace settings Immutable.Map
get_settings(): Immutable.Map - get settings tree.
has_setting(arg_name:string|array): boolean - test if a value is avalaible for given key or path.
get_setting(arg_name:string|array, arg_default): Immutable or js value - get value from a path or a key.
set_setting(arg_name:string|array, arg_value): nothing - set or replace a value at given key or path.
Constructor Summary
Public Constructor | ||
public |
constructor(arg_settings: Immutable.Map | object, arg_log_context: string, arg_logger_manager: LoggerManager): nothing Create a Settingsable instance. |
Member Summary
Public Members | ||
public |
Instance settings (default undefined). |
|
public |
Class type flag. |
Method Summary
Public Methods | ||
public |
get_setting(arg_name: string | array, arg_default: any): any Get a value in settings for given key. |
|
public |
get_setting_js(arg_name: string | array, arg_default: any): any Get a value in settings for given key. |
|
public |
get_settings(): Immutable.Map Get instance settings. |
|
public |
get_settings_js(): Immutable.Map Get instance settings. |
|
public |
has_setting(arg_name: string): boolean Test if a key exists in settings. |
|
public |
set_setting(arg_name: string, arg_value: any): nothing Set a value in settings for given key. |
|
public |
set_settings(arg_settings: Immutable.Map): nothing Set instance settings. |
Inherited Summary
From class Loggable | ||
public |
Log context. |
|
public |
Class type flag. |
|
public |
Trace is enabled for this flag. |
|
private |
Logger manager instance (default undefined) |
|
public |
Trace DEBUG formatted message. |
|
public |
disable_trace(): nothing Disable traces. |
|
public |
enable_trace(): nothing Enable traces. |
|
public |
enter_group(arg_group: string): nothing Trace INFO message on "enter trace group". |
|
public |
Trace ERROR formatted message. |
|
public |
Define get class name method for non Instance classes. |
|
public |
Get instance context. |
|
public |
Get logger manager. |
|
public |
Define get instance name method for non Instance classes. |
|
public |
Get trace flag. |
|
public |
Trace INFO formatted message. |
|
public |
leave_group(arg_group: string): nothing Trace INFO message on "leave trace group". |
|
public |
separate_level_1(): nothing Trace INFO trace level 1 separator. |
|
public |
separate_level_2(): nothing Trace INFO trace level 2 separator. |
|
public |
separate_level_3(): nothing Trace INFO trace level 3 separator. |
|
public |
Set trace flag. |
|
public |
should_trace(arg_traces_cfg: object): boolean Calculate should trace flag. |
|
public |
should_trace_class(arg_traces_cfg: object): boolean Calculate should trace flag for classes. |
|
public |
should_trace_collection_item(arg_traces_cfg: object, arg_collection_name: string, arg_this_item_accessor: string): boolean Calculate should trace flag for given collection of names or patterns. |
|
public |
should_trace_module(arg_traces_cfg: object): boolean Calculate should trace flag for modules. |
|
public |
should_trace_name(arg_traces_cfg: object): boolean Calculate should trace flag for instances names. |
|
public |
Toggle trace flag. |
|
public |
update_trace_enabled(): nothing Update trace enabled flag. |
|
public |
Trace WARN formatted message. |
From class Errorable | ||
private |
Error text (default null). |
|
private |
Has error flag (default false). |
|
public |
Set an error. |
|
public |
Default helper for "not implemented" error. |
|
public |
Get error message. |
|
public |
Test is an error is set. |
Public Constructors
public constructor(arg_settings: Immutable.Map | object, arg_log_context: string, arg_logger_manager: LoggerManager): nothing source
Create a Settingsable instance.
Override:
Errorable#constructorParams:
Name | Type | Attribute | Description |
arg_settings | Immutable.Map | object | instance settings map. |
|
arg_log_context | string | trace context string. |
|
arg_logger_manager | LoggerManager | logger manager object (optional). |
Return:
nothing |
Public Members
Public Methods
public get_setting(arg_name: string | array, arg_default: any): any source
Get a value in settings for given key.
Params:
Name | Type | Attribute | Description |
arg_name | string | array | settings value key. |
|
arg_default | any | default value. |
Return:
any | found value or given default value |
public get_setting_js(arg_name: string | array, arg_default: any): any source
Get a value in settings for given key.
Params:
Name | Type | Attribute | Description |
arg_name | string | array | settings value key. |
|
arg_default | any | default value. |
Return:
any | found value or given default value |
public has_setting(arg_name: string): boolean source
Test if a key exists in settings.
Params:
Name | Type | Attribute | Description |
arg_name | string | settings value key. |
public set_setting(arg_name: string, arg_value: any): nothing source
Set a value in settings for given key.
Params:
Name | Type | Attribute | Description |
arg_name | string | settings value key. |
|
arg_value | any | settings value. |
Return:
nothing |
public set_settings(arg_settings: Immutable.Map): nothing source
Set instance settings.
Params:
Name | Type | Attribute | Description |
arg_settings | Immutable.Map | instance settings map. |
Return:
nothing |