OlapicEntity
Direct Subclass:
This is the abstract class that all the entities will extend and implement.
Constructor Summary
Public Constructor | ||
public |
constructor(data: Object) The class constructor that will receive all the entity information. |
Member Summary
Public Members | ||
public |
An alias/name for the entity, for debug purposes. |
|
public |
The entity information. |
|
public get |
A quick shortcut for the entities so they can access their own entities handler. |
Method Summary
Public Methods | ||
public |
Access the entity data using a path-like format. |
|
public |
A utility method that returns the entity name/alias. |
Public Constructors
public constructor(data: Object) source
The class constructor that will receive all the entity information. On an implementation,
this object will be instantiated from the entityFromJSON
handler method, which will take
care of parsing raw data before creating the entity.
All the information sent with the data
argument will later be accessible using the get
method.
Params:
Name | Type | Attribute | Description |
data | Object | The entity information. |
Public Members
public get handler: OlapicEntitiesHandler: * source
A quick shortcut for the entities so they can access their own entities handler.
For example, the OlapicMediaEntity
will get the OlapicMediaHandler
.
Public Methods
public get(path: string): * source
Access the entity data using a path-like format.
Params:
Name | Type | Attribute | Description |
path | string | The path-like name for the property. |
Return:
* | The value of the wanted property. |
Example:
let entity = new OlapicEntity({
name: 'MyEntity',
props: {
olapic: 'rocks',
},
});
// This will log 'MyEntity'
console.log(entity.get('name'));
// This will log 'rocks'
console.log(entity.get('props/olapic'));