SpecificationContext
pentaho.type.SpecificationContext
A class that holds information that is shared during the serialization (or conversion to specification) of instances and types.
Specifically, a specification context tracks the temporary identifiers assigned to referenced anonymous types.
The ambient specification context is accessible through SpecificationContext.current
.
Methods like Instance#toSpec
, Type#toSpec
and Type#toRef
use the ambient specification context, when set, to provide context to the serialization process. When not set, these create a new specification context and set it as current.
Managing the ambient specification context is best handled implicitly, by delegating to a SpecificationScope
instance.
AMD Module
require(["pentaho/type/SpecificationContext"], function(SpecificationContext) { /* code goes here */ });
Implements
Constructor
Name | Description |
---|---|
new SpecificationContext() | Creates a |
Members
Name | Description |
---|---|
current : Static | Gets or sets the ambient specification context. |
idTemporaryPrefix : Static | The prefix of temporary identifiers. |
Methods
Name | Description |
---|---|
isIdTemporary(id) : boolean Static | Determines if a given type identifier is temporary. |
add(type, tid) : nonEmptyString | Adds a type to the context and returns its own or temporary identifier. |
dispose() | Disposes this specification context. |
get(tid) : pentaho.type.Type | Gets a type given its temporary identifier in this specification context. |
getIdOf(type) : nonEmptyString | Gets the identifier of a type, if it has one; or, its temporary identifier within this context, if not. |
Constructor Details
new SpecificationContext() |
---|
Creates a Source: javascript/web/pentaho/type/SpecificationContext.js, line 29 |
Members Details
current: Static |
---|
Gets or sets the ambient specification context. Source: javascript/web/pentaho/type/SpecificationContext.js, line 182 |
idTemporaryPrefix: Static |
---|
The prefix of temporary identifiers. Source: javascript/web/pentaho/type/SpecificationContext.js, line 213 Default Value: "_:" |
Methods Details
isIdTemporary(id) : boolean Static | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Determines if a given type identifier is temporary. Source: javascript/web/pentaho/type/SpecificationContext.js, line 201
See also: pentaho.type.SpecificationContext.idTemporaryPrefix |
add(type, tid) : nonEmptyString | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Adds a type to the context and returns its own or temporary identifier. If the given type is not anonymous, its identifier is returned. Else, if the anonymous type had already been added to the context, its temporary identifier is returned. Else, the anonymous type is added to the context and a temporary identifier is either given, or automatically generated and returned. Source: javascript/web/pentaho/type/SpecificationContext.js, line 136
|
dispose() |
---|
Disposes this specification context. If this is the ambient specification context, it is cleared. Source: javascript/web/pentaho/type/SpecificationContext.js, line 170 |
get(tid) : pentaho.type.Type | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets a type given its temporary identifier in this specification context. Source: javascript/web/pentaho/type/SpecificationContext.js, line 114
|
getIdOf(type) : nonEmptyString | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Gets the identifier of a type, if it has one; or, its temporary identifier within this context, if not. If the given type is anonymous and also has not been added to this context, Source: javascript/web/pentaho/type/SpecificationContext.js, line 98
|