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

Simple

pentaho.type. Simple

The base, abstract class of unstructured values.

AMD Module

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

See also: pentaho.type.Complex , pentaho.type.spec.ISimple , pentaho.type.spec.ISimpleType

Extends

Constructor

Name Description
new Simple(spec)

Creates a simple instance.

Members

Name Description
$contentKey :  string

Gets the content key of the simple value.

$isValid :  boolean

Determines if this value is a valid.

$key :  string

Gets the key of the simple value.

$type :  pentaho.type.ValueType

Gets the type of this instance.

formatted :  nonEmptyString

Gets the formatted value of the property.

value :  *

Gets the underlying JavaScript value represented by the simple value.

Methods

Name Description
_compare(other) : number
Protected

Compares this element to a distinct, non-equal element of the same type according to its relative order.

_configure(config)
Protected

Configures this value with a given distinct and non-Nully configuration.

_configureOrCreate(config) : pentaho.type.Element
Protected

Configures this value with a given distinct and non-Nully configuration, if it is possible. Otherwise creates and returns a new value based on this one, but with the configuration applied.

_equals(other) : boolean
Protected

Gets a value that indicates if a given distinct, non-null value of the same type represents the same entity.

_toJSONValue(keyArgs) : JsonValue
Protected

Converts the value of the simple instance to a JSON-compatible representation.

assertValid()

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

clone() : pentaho.type.Simple

Creates a clone of the simple value.

compare(other) : number

Compares this element to another according to its relative order.

configure(config)

Configures this value with a given configuration.

configureOrCreate(config) : pentaho.type.Element

Configures this value with a given configuration, if it is possible. Otherwise creates and returns a new value based on this one, but with the configuration applied.

equals(other) : boolean

Determines if a given value represents the same entity.

equalsContent(other) : boolean

Gets a value that indicates if a given equal value has the same content as this one.

toJSON() : JsonValue

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

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

Creates a specification that describes this value.

toSpecInContext(keyArgs) : *

Creates a specification that describes this instance.

toString() : string

Gets a string that represents the current simple value.

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

Determines if this value is valid.

valueOf() : *

Gets the underlying primitive value of the simple value.

Constructor Details

new Simple(spec)

Creates a simple instance.

Source: javascript/web/pentaho/type/Simple.js, line 47

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

A simple specification.

See also: pentaho.type.Complex , pentaho.type.spec.ISimple , pentaho.type.spec.ISimpleType

Members Details

$contentKey:  string

Gets the content key of the simple value.

Source: javascript/web/pentaho/type/Simple.js, line 158

$isValid:  boolean

Determines if this value is a valid.

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

Source: javascript/web/pentaho/type/Value.js, line 168

Inherited From: pentaho.type.Value#$isValid

$key:  string

Gets the key of the simple value.

The default simple value implementation, returns the result of calling toString() on pentaho.type.Simple#value.

Source: javascript/web/pentaho/type/Simple.js, line 148

Overrides: pentaho.type.Element#$key

See also: pentaho.type.SimpleType#isEntity

$type:  pentaho.type.ValueType

Gets the type of this instance.

Source: javascript/web/pentaho/type/Value.js, line 334

Overrides: pentaho.type.Element#$type

formatted:  nonEmptyString

Gets the formatted value of the property.

Source: javascript/web/pentaho/type/Simple.js, line 98

value:  *

Gets the underlying JavaScript value represented by the simple value.

Source: javascript/web/pentaho/type/Simple.js, line 89

Methods Details

_compare(other) : number
Protected

Compares this element to a distinct, non-equal element of the same type according to its relative order.

This method compares the primitive value of this value with that of other by delegating to the comparePrimitiveValues method.

Source: javascript/web/pentaho/type/Simple.js, line 214

Overrides: pentaho.type.Element#_compare

Parameters:
Name Default Value Summary
other : pentaho.type.Simple

The other value.

Returns:
Name Description
number

-1 if this value is before other; 1 if this value is after other; 0, otherwise.

See also: pentaho.type.SimpleType#comparePrimitiveValues

_configure(config)
Protected

Configures this value with a given distinct and non-Nully configuration.

This method can only be called when there is an ambient transaction.

The default implementation throws an error if this value's type is read-only.

Source: javascript/web/pentaho/type/Value.js, line 264

Inherited From: pentaho.type.Value#_configure

Parameters:
Name Default Value Summary
config : *

The distinct, non-Nully configuration.

Throws:
Name Description
TypeError

When the value would be changed and its type is read-only.

See also: pentaho.type.Value#configure , pentaho.type.Complex#_configure , pentaho.type.List#_configure

_configureOrCreate(config) : pentaho.type.Element
Protected

Configures this value with a given distinct and non-Nully configuration, if it is possible. Otherwise creates and returns a new value based on this one, but with the configuration applied.

This method can only be called when there is an ambient transaction.

Source: javascript/web/pentaho/type/Element.js, line 175

Inherited From: pentaho.type.Element#_configureOrCreate

Parameters:
Name Default Value Summary
config : *

The non-Nully configuration. Assumed distinct from this.

Returns:
Name Description
pentaho.type.Element

this, already configured, or a new value.

See also: pentaho.type.Element#configureOrCreate , pentaho.type.Value#configure

_equals(other) : boolean
Protected

Gets a value that indicates if a given distinct, non-null value of the same type represents the same entity.

This method checks if the primitive value of one is equal to the primitive value of the other.

Source: javascript/web/pentaho/type/Simple.js, line 177

Overrides: pentaho.type.Element#_equals

Parameters:
Name Default Value Summary
other : pentaho.type.Simple

A distinct value to test for equality.

Returns:
Name Description
boolean

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

See also: pentaho.type.Value#equals

_toJSONValue(keyArgs) : JsonValue
Protected

Converts the value of the simple instance to a JSON-compatible representation.

The default implementation returns value itself. Override to implement a custom JSON format for this simple value type.

Source: javascript/web/pentaho/type/Simple.js, line 287

Parameters:
Name Default Value Summary
keyArgs : object

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

Returns:
Name Description
JsonValue | null

A JSON-compatible representation of value.

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 202

Inherited From: pentaho.type.Value#assertValid

Throws:
Name Description
pentaho.type.ValidationError

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

clone() : pentaho.type.Simple

Creates a clone of the simple value.

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

Overrides: pentaho.type.Element#clone

Returns:
Name Description
pentaho.type.Simple

The simple value clone.

compare(other) : number

Compares this element to another according to its relative order.

Execution proceeds as follows:

  1. If other is Nully, it is considered to occur before this one;
  2. If other is identical to this one, as per JavaScript's === operator, it has the same order;
  3. If other does not have the same constructor as this one, it has the same order;
  4. If other is _equals to this one, it has the same order;
  5. Otherwise, the operation is delegated to the first value's _compare method.

Source: javascript/web/pentaho/type/Element.js, line 76

Inherited From: pentaho.type.Element#compare

Parameters:
Name Default Value Summary
other : pentaho.type.Element | undefined

The other element value.

Returns:
Name Description
number

-1 if this value is before other; 1 if this value is after other; 0, otherwise.

See also: pentaho.type.Element#_compare , pentaho.type.Value#equals

Implements:
configure(config)

Configures this value with a given configuration.

This method ensures a transaction exists and then delegates to _configure.

For more information on the semantics of configuration, see Complex#_configure and List#_configure.

Source: javascript/web/pentaho/type/Value.js, line 232

Inherited From: pentaho.type.Value#configure

Parameters:
Name Default Value Summary
config : *

The value configuration.

Throws:
Name Description
TypeError

When the value would be changed and its type is read-only.

See also: pentaho.type.Element#configureOrCreate , pentaho.type.Complex#_configure , pentaho.type.List#_configure

configureOrCreate(config) : pentaho.type.Element

Configures this value with a given configuration, if it is possible. Otherwise creates and returns a new value based on this one, but with the configuration applied.

If the given configuration is Nully or identical to this, then this is immediately returned. Otherwise, this method ensures that a transaction exists and delegates to the _configureOrCreate method.

This method considers configuration to not be possible in the following situations:

  1. this instance is of a read-only type;
  2. config is of an isEntity type and is not equals to this value;
  3. config is not an instance of an isEntity type but is an instance of Value and its constructor is not the same as this;
  4. config is not an instance of Value - it is a specification and: 4.1. it contains an inline type property, _, identifying a different type than that of this instance; 4.2. this instance is of an isEntity type and config contains key properties that reference another entity.

If configuration is considered possible, the actual configuration is delegated to the configure method.

Source: javascript/web/pentaho/type/Element.js, line 141

Inherited From: pentaho.type.Element#configureOrCreate

Parameters:
Name Default Value Summary
config : *

The value configuration.

Returns:
Name Description
pentaho.type.Element

this value, if the configuration could be applied to it; a new, configured value, if not.

equals(other) : boolean

Determines if a given value represents the same entity.

This method checks if the given value is identical to this one. Otherwise, if not Nully and has the same constructor, execution is delegated to this value's _equals method.

Source: javascript/web/pentaho/type/Value.js, line 116

Inherited From: pentaho.type.Value#equals

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

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#_equals

equalsContent(other) : boolean

Gets a value that indicates if a given equal value has the same content as this one.

This method checks if the formatted value of the given value is the same as that of this one.

Source: javascript/web/pentaho/type/Simple.js, line 194

Overrides: pentaho.type.Element#equalsContent

Parameters:
Name Default Value Summary
other : pentaho.type.Simple

An equal simple value to test for content-equality.

Returns:
Name Description
boolean

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

See also: pentaho.type.Value#equals

toJSON() : JsonValue

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 198

Inherited From: pentaho.type.Instance#toJSON

Returns:
Name Description
JsonValue | null

A JSON-compatible specification.

See also: pentaho.type.Instance#toSpec

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

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 272

Inherited From: pentaho.type.Value#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.Instance | null

A specification of this value.

toSpecInContext(keyArgs) : *

Creates a specification that describes this instance.

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

Overrides: pentaho.type.Element#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
*

A specification of this instance.

See also: pentaho.type.Instance#toSpec

toString() : string

Gets a string that represents the current simple value.

Source: javascript/web/pentaho/type/Simple.js, line 133

Returns:
Name Description
string

The string representation.

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

Determines if this value is valid.

The default implementation does nothing and considers the instance valid. Override to implement a type's specific validation logic.

You can use the error utilities in pentaho.type.Util to help in the implementation.

Source: javascript/web/pentaho/type/Value.js, line 187

Inherited From: pentaho.type.Value#validate

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

A non-empty array of errors or null.

See also: pentaho.type.Value#$isValid

valueOf() : *

Gets the underlying primitive value of the simple value.

Source: javascript/web/pentaho/type/Simple.js, line 124

Returns:
Name Description
*

The underlying value.