Class: Data

capsula.Data(opt_dataopt)

Data is a specific public property of a capsule. It serves to store the given information and to protect them from illegal access.

Constructor

new Data(opt_dataopt)

Creates new data as a property of the capsule that represents the current context of execution.
Parameters:
Name Type Attributes Description
opt_data Object <optional>
information to store and protect
Since:
  • 0.2.0
Source:
Throws:
Type
Error

Methods

get() → {Object}

Returns protected information of this data.
Since:
  • 0.2.0
Source:
Throws:
Type
Error
Returns:
protected information (data) of this data
Type
Object

getFQName(opt_sepopt) → {string}

Returns the fully qualified name of this data, using the given separator if provided (if not, the :: is used by default).

The fully qualified name comprises the name of this data, the name of the owner capsule of this data, the name of its owner, and so on all the way up the capsule hierarchy.

Parameters:
Name Type Attributes Description
opt_sep string <optional>
the separator to use to separate names in the returned fully qualified name
Since:
  • 0.2.0
Source:
Throws:
Type
Error
Returns:
the fully qualified name of this data
Type
string

getId() → {number}

Returns the id of this data.
Since:
  • 0.2.0
Source:
Throws:
Type
Error
Returns:
the id of this data
Type
number

getName() → {string}

Returns the name of this data.
Since:
  • 0.2.0
Source:
Throws:
Type
Error
Returns:
the name of this data
Type
string

getOwner() → {module:capsula.Capsule}

Returns the owner capsule of this data.
Since:
  • 0.2.0
Source:
Throws:
Type
Error
Returns:
the owner capsule of this data
Type
module:capsula.Capsule

set(data)

Sets protected information to this data.
Parameters:
Name Type Description
data Object protected information of this data
Since:
  • 0.2.0
Source:
Throws:
Type
Error

setName(name)

Sets a new name to this data.
Parameters:
Name Type Description
name string a new name of this data
Since:
  • 0.2.0
Source:
Throws:
Type
Error