Skip to main content

Pentaho+ documentation is moving!

The new product documentation portal is here. Check it out now at docs.hitachivantara.com

 

Hitachi Vantara Lumada and Pentaho Documentation

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 and Type#toSpec 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 SpecificationContext.

Members

Name Description
current :  pentaho.type.SpecificationContext
Static

Gets or sets the ambient specification context.

idTemporaryPrefix :  nonEmptyString
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 SpecificationContext.

Source: javascript/web/pentaho/type/SpecificationContext.js, line 29

Members Details

current:  pentaho.type.SpecificationContext
Static

Gets or sets the ambient specification context.

Source: javascript/web/pentaho/type/SpecificationContext.js, line 181

idTemporaryPrefix:  nonEmptyString
Static

The prefix of temporary identifiers.

Source: javascript/web/pentaho/type/SpecificationContext.js, line 212

Default Value: "_:"

See also: pentaho.type.SpecificationContext.isIdTemporary

Methods Details

isIdTemporary(id) : boolean
Static

Determines if a given type identifier is temporary.

Source: javascript/web/pentaho/type/SpecificationContext.js, line 200

Parameters:
Name Default Value Summary
id : string

The identifier to check.

Returns:
Name Description
boolean

true if the identifier is temporary; `false, otherwise.

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 135

Parameters:
Name Default Value Summary
type : pentaho.type.Type

The type to add.

tid : nonEmptyString
Optional

The temporary identifier to use when adding.

Returns:
Name Description
nonEmptyString

The identifier of the type within this context.

Throws:
Name Description
pentaho.lang.ArgumentInvalidError

When type is being added and tid is already the temporary identifier assigned to another type.

Implements:
dispose()

Disposes this specification context.

If this is the ambient specification context, it is cleared.

Source: javascript/web/pentaho/type/SpecificationContext.js, line 169

get(tid) : pentaho.type.Type

Gets a type given its temporary identifier in this specification context.

Source: javascript/web/pentaho/type/SpecificationContext.js, line 113

Parameters:
Name Default Value Summary
tid : nonEmptyString

The temporary identifier.

Returns:
Name Description
pentaho.type.Type

The type with the given temporary identifier, if any; or, null.

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, null is returned.

Source: javascript/web/pentaho/type/SpecificationContext.js, line 97

Parameters:
Name Default Value Summary
type : pentaho.type.Type

The type.

Returns:
Name Description
nonEmptyString | null

The identifier of the type within this context, or null.