Skip to main content
Pentaho Documentation

Value

pentaho.type.Value

The base, abstract class of instances which are the value of properties.

A Value has a key that uniquely identifies the entity it represents.

AMD Module

require(["pentaho/type/value"], function(Value) { /* code goes here */ });

See also:  pentaho.type.spec.IValue , pentaho.type.spec.IValueProto , pentaho.type.spec.IValueTypeProto

Extends

Implements

Constructor

Name Description
new Value(spec)
 
Abstract

Creates a Value instance.

Classes

Name Summary
Type

The base type class of value types.

Members

Name Description
$isValid : boolean

Determines if this value is a valid instance of its type.

$key : string

Gets the key of the value.

$type : pentaho.type.Value.Type

Gets the type of this instance.

Methods

Name Description
extend(name, instSpec, classSpec, keyArgs) : Class.<pentaho.type.Value>
 
Static

Creates a subtype of this one.

_configure(config)
 
Protected

Configures this value with a given non-nully configuration.

assertValid()

Ensures that the value is valid, and throws the first validation error if it is not.

clone() : pentaho.type.Value
 
Abstract

Creates a shallow clone of this value.

configure(config) : pentaho.type.Value

Configures this value with a given configuration.

equals(other) : boolean

Determines if a given value, of the same type, represents the same entity.

toJSON() : UJsonValue

Creates a top-level JSON specification that describes this instance.

toSpec(keyArgs) : pentaho.type.spec.UInstance

Creates a specification that describes this value.

toSpecInContext(keyArgs) : any
 
Abstract

Creates a specification that describes this instance.

validate() : Array.<pentaho.type.ValidationError>

Determines if this value is a valid instance of its type.

Constructor Details

new Value(spec)
 
Abstract

Creates a Value instance.

Source: javascript/web/pentaho/type/value.js, line 44

Parameters:
Name Default Value Summary
spec : pentaho.type.spec.UValue
 
Optional

A value specification.

See also:  pentaho.type.spec.IValue , pentaho.type.spec.IValueProto , pentaho.type.spec.IValueTypeProto

Members Details

$isValid: boolean

Determines if this value is a valid instance of its type.

This attribute calls validate and returns a boolean value indicating if it returned no errors.

Source: javascript/web/pentaho/type/value.js, line 123

$key: string

Gets the key of the value.

The key of a value must identify it among values of the same concrete type. Two values of the same concrete type and with the same key represent the same entity.

The default implementation returns the result of calling toString().

Source: javascript/web/pentaho/type/value.js, line 82

See also:  pentaho.type.Value#equals , pentaho.type.Value.Type#areEqual

$type: pentaho.type.Value.Type

Gets the type of this instance.

Source: javascript/web/pentaho/type/value.js, line 246

Overrides: pentaho.type.Instance#$type

Methods Details

extend(name, instSpec, classSpec, keyArgs) : Class.<pentaho.type.Value>
 
Static

Creates a subtype of this one.

For more information on class extension, in general, see pentaho.lang.Base.extend.

Source: javascript/web/pentaho/type/value.js, line 429

Parameters:
Name Default Value Summary
name : string
 
Optional

The name of the created class; used for debugging purposes.

instSpec : pentaho.type.spec.IValueProto
 
Optional

The instance specification.

classSpec : Object
 
Optional

The static specification.

keyArgs : Object
 
Optional

The keyword arguments.

Returns:
Name Description
Class.<pentaho.type.Value>

The new value instance subclass.

See also:  pentaho.type.Instance.extend

_configure(config)
 
Protected

Configures this value with a given non-nully configuration.

The default implementation does nothing.

Source: javascript/web/pentaho/type/value.js, line 178

Parameters:
Name Default Value Summary
config : any

The configuration.

assertValid()

Ensures that the value is valid, and throws the first validation error if it is not.

This method calls the validate method.

Source: javascript/web/pentaho/type/value.js, line 152

Throws:
Name Description
pentaho.type.ValidationError

When the value is not valid, the first error returned by the validate method.

clone() : pentaho.type.Value
 
Abstract

Creates a shallow clone of this value.

Source: javascript/web/pentaho/type/value.js, line 86

Returns:
Name Description
pentaho.type.Value

The value clone.

Implements:
configure(config) : pentaho.type.Value

Configures this value with a given configuration.

Source: javascript/web/pentaho/type/value.js, line 165

Parameters:
Name Default Value Summary
config : any

The configuration.

Returns:
Name Description
pentaho.type.Value

This instance.

equals(other) : boolean

Determines if a given value, of the same type, represents the same entity.

The default implementation delegates the operation to the _isEqual method.

Source: javascript/web/pentaho/type/value.js, line 107

Parameters:
Name Default Value Summary
other : any

A value to test for equality.

Returns:
Name Description
boolean

true if the given value is equal to this one; or, false, otherwise.

See also:  pentaho.type.Value#$key , pentaho.type.Value.Type#areEqual

toJSON() : UJsonValue

Creates a top-level JSON specification that describes this instance.

Attributes which do not have a JSON-compatible specification are omitted. Specifically, for inline types, attributes with a function value are not supported.

This method simply calls pentaho.type.Instance#toSpec with argument keyArgs.isJson as true and exists for seamless integration with JavaScript's JSON.stringify method.

Source: javascript/web/pentaho/type/instance.js, line 210

Inherited From: pentaho.type.Instance#toJSON

Returns:
Name Description
UJsonValue

A JSON-compatible specification.

See also:  pentaho.type.Instance#toSpec

Implements:
toSpec(keyArgs) : pentaho.type.spec.UInstance

Creates a specification that describes this value.

If an ambient specification context, currently exists, it is used to manage the serialization process. Otherwise, one is created and set as current. Then, the actual work is delegated to pentaho.type.Instance#toSpecInContext.

Source: javascript/web/pentaho/type/value.js, line 184

Overrides: pentaho.type.Instance#toSpec

Parameters:
Name Default Value Summary
keyArgs : Object
 
Optional

The keyword arguments object. Passed to every value and type serialized within this scope.

Please see the documentation of value subclasses for information on additional, supported keyword arguments.

Parameters:
Name Default Value Summary
isJson : boolean
 
Optional
false

Generates a JSON-compatible specification. Attributes which do not have a JSON-compatible specification are omitted.

declaredType : pentaho.type.Type
 
Optional

The base type of this value's storage location. If the value does not have this exact type, its inline type property must be included in the specification. Otherwise, it can be omitted. When unspecified, the inline type property is only included if forceType is true.

forceType : boolean
 
Optional
false

Forces inclusion of the inline type property, _, in the specification.

omitFormatted : boolean
 
Optional
false

Omits the formatted value on Simple values' specifications.

preferPropertyArray : boolean
 
Optional
false

Indicates that, if possible, array form is used for Complex values' specifications.

The array form of a complex value cannot be used when its type must be inlined.

includeDefaults : boolean
 
Optional
false

When true, all of the properties of Complex values are serialized. When false, the default, only properties whose value is different from their default value are serialized.

Only applies to complex values that are serialized in object form. In array form, all of the properties of complex values are serialized independently of their value.

omitProps : Object
 
Optional

An object whose own property names with a truthy value are the names of the properties of the current complex type to omit from the serialization.

Only applies when a complex is output in object form. In array form, all properties are output whatever their value.

This argument only applies to complex values and is not passed through to the values of their properties.

Returns:
Name Description
pentaho.type.spec.UInstance

A specification of this value.

toSpecInContext(keyArgs) : any
 
Abstract

Creates a specification that describes this instance.

Source: javascript/web/pentaho/type/instance.js, line 190

Inherited From: pentaho.type.Instance#toSpecInContext

Parameters:
Name Default Value Summary
keyArgs : Object
 
Optional

The keyword arguments' object. Passed to every instance and type serialized within this scope.

Please see the documentation of subclasses for information on additional, supported keyword arguments.

Returns:
Name Description
any

A specification of this instance.

See also:  pentaho.type.Instance#toSpec

validate() : Array.<pentaho.type.ValidationError>

Determines if this value is a valid instance of its type.

The default implementation delegates to pentaho.type.Value.Type#_validate.

Source: javascript/web/pentaho/type/value.js, line 137

Returns:
Name Description
Array.<pentaho.type.ValidationError>

A non-empty array of errors or null.

See also:  pentaho.type.Value#$isValid