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

spec

pentaho.type. spec

The type.spec namespace contains specification interfaces and type definitions.

Source: doc-js/pentaho/type/spec/_namespace.jsdoc, line 17

Interfaces

Name Summary
IComplex

The spec.IComplex interface describes a complex instance in object form.

IComplexType

The spec.IComplexType interface represents the specification of a complex type.

IDate

The spec.IDate interface describes a date value in object form.

IFunction

The spec.IFunction interface describes a function value in object form.

IInstance

The spec.IInstance interface describes an instance using a generic, object form.

IList

The spec.IList interface describes a list value in object form.

IListType

The spec.IListType interface represents the specification of a list type.

IPropertyType

The spec.IPropertyType interface represents the information used to define a property of a complex type.

ISimple

The spec.ISimple interface describes a simple value in object form.

ISimpleType

The spec.ISimpleType interface represents the specification of a simple type.

IType

The spec.IType interface represents the specification of a type.

ITypeDescriptor

The spec.ITypeDescriptor interface describes a type descriptor in object form.

IValue

The spec.IValue interface describes a value instance using a generic, object form.

IValueType

The spec.IValueType interface represents the specification of a value type.

Type Definitions

Complex:  pentaho.type.spec.IComplex | Array.<?pentaho.type.spec.Instance>

A spec.Complex represents the union of JS types that can be used to describe a complex value.

Like with all other value types, complex values can be described using the general object form. The object form conforms to pentaho.type.spec.IComplex.

Complex values support an additional form of value specification, the array form: an array of pentaho.type.spec.Instance, each the specification of the value of one of a complex's properties, in property definition order, according to PropertyType#index.

Take the following object form example:

{
  product: "boeing-737",
  price:   1500
}

Assuming that the two properties were defined in the order "product" then "price", it could be written in array form, like this:

["boeing-737", 1500]

However, note that array form can only be used if the inline type property can, in fact, be omitted.

Source: doc-js/pentaho/type/spec/Complex.jsdoc, line 17

Element:  pentaho.type.spec.Complex | pentaho.type.spec.Simple

A spec.Element represents the union of JS types that can be used to describe an element instance.

Source: doc-js/pentaho/type/spec/Element.jsdoc, line 17

EnvironmentPropertyFilter:  * | Nully | Array

A spec.EnvironmentPropertyFilter represents the union of JS types that can be used to filter the value of an environment variable, in the select attribute of a type configuration rule.

A Nully filter is equivalent to not filtering a variable. When unfiltered, any environment variable value is matched.

An array filter matches an environment variable if any of the values in the array are the same exact value of the environment variable.

Any other value is assumed to be a single value, and matches the environment variable if it is the same value.

Source: doc-js/pentaho/type/spec/EnvironmentPropertyFilter.jsdoc, line 17

Instance:  pentaho.type.spec.IInstance | pentaho.type.spec.Value | Nully

A spec.Instance represents the union of JS types that can be used to describe an instance, or the absence of one.

When an instance is described using object form, its specification is of type spec.IInstance.

To describe an absent instance, use a Nully JavaScript value.

Source: doc-js/pentaho/type/spec/Instance.jsdoc, line 17

List:  pentaho.type.spec.IList | Array.<pentaho.type.spec.Element>

A spec.List represents the union of JS types that can be used to describe a list value.

Like with all other value types, list values can be described using the general object form. The object form conforms to pentaho.type.spec.IList.

List values support an additional form of value specification, the array form: an array of pentaho.type.spec.Instance, each the specification of the corresponding element of the list.

Take the following example of a number list in object form:

{
  _: {base: "list", of: "number"},
  d: [1, 2, 3]
}

In array form, if we assume the type of the list is implied, the same list could be written simply as:

[1, 2, 3]

However, note that array form can only be used if the inline type property can, in fact, be omitted.

A list of complex values can be written in array form, and its complex elements be written in array form, as well. For example:

[
  ["boeing-737",  1500],
  ["airbus-A320", 1000]
]

Source: doc-js/pentaho/type/spec/List.jsdoc, line 17

PropertyDynamicAttribute(propType, keyArgs) : T

The signature of a function of a dynamic attribute of a property.

Examples of dynamic property attributes:

Source: doc-js/pentaho/type/spec/PropertyDynamicAttribute.jsdoc, line 17

Parameters:
Name Default Value Summary
propType : pentaho.type.PropertyType

The property type being evaluated.

keyArgs : object
Optional

The keyword arguments object.

Returns:
Name Description
T

The calculated attribute's value.

PropertyType:  string | pentaho.type.spec.IPropertyType

A spec.PropertyType represents the union of JS types that can be used to define a property of a complex type.

When the value is a string, it's taken to represent a property whose pentaho.type.spec.IPropertyType#name is that string and whose pentaho.type.spec.IPropertyType#valueType is pentaho.type.String.

Source: doc-js/pentaho/type/spec/PropertyType.jsdoc, line 17

Simple:  pentaho.type.spec.ISimple | *

A spec.Simple represents the union of JS types that can be used to describe a simple value, or the absence of one.

Like with all other value types, simple values can be described using the general object form. The object form conforms to pentaho.type.spec.ISimple.

The following is an example of an object form specification:

{v: 1, f: "1.0"}

If the formatted is not defined, it can be written more concisely as:

{v: 1}

or, simply, as:

1

Note that, when the underlying JavaScript value is a plain object, it must always be described using the generic object form, spec.ISimple, as in:

{v: {}}

Note that a simple value cannot have a Nully as its underlying JavaScript value, and, as such, the following example would not be valid:

{v: null} // throws if given to a Simple, derived constructor

A Simple instance can also be used as a simple value specification, in which case it is used as a source of its value and formatted properties.

To know, exactly, which types of JavaScript values are accepted as specifications of a specific pentaho.type.spec.ISimple subtype, see the subtype's documentation.

Source: doc-js/pentaho/type/spec/Simple.jsdoc, line 17

TypeReference:  nonEmptyString | pentaho.type.Type | Class.<pentaho.type.Instance> | Array.<pentaho.type.spec.TypeReference> | pentaho.type.spec.IType

The spec.TypeReference union represents the set of JS types that can be used to reference a type.

It can be one of the following:

A type id string

A type's permanent id ??? the identifier of a defined module in the AMD module system ???, or a temporary, serialization-only identifier.

When an identifier is permanent and does not contain any "/" character, it is considered a standard type and is taken relative to Pentaho's "pentaho/type" module.

Note that relative AMD module identifiers, such as "./foo", are not supported.

Example absolute, permanent identifier:

"pentaho/type/String"

Example temporary identifier:

"_:1"
An instance constructor function

A reference to an instance constructor, like Complex.

Example:

require(["pentaho/type/loader", "pentaho/type/Complex"], function(typeLoader, Complex) {

  typeLoader.resolveType(Complex);

});
A type object

A type's singleton object, like Number.type, where Number is Number.

Example:

require(["pentaho/type/loader", "pentaho/type/Number"], function(typeLoader, PentahoNumber) {

  var numberType = PentahoNumber.type;

  // Create a number list type
  var NumberList = typeLoader.resolveType([numberType]);

  var numbers = new NumberList([1, 2, 3]);

  // ...
});
A generic type specification object

A plain Object specification used to generically describe a type. Satisfies the interface spec.IType.

The special base attribute allows specifying the base type and defaults to "pentaho/type/Complex", on a global context, or to the valueType of the base property, when overriding it. Any additional attributes are determined and processed by each type's pentaho.type.Type.extend method.

Example:

require(["pentaho/type/loader"], function(typeLoader) {

  // Create an anonymous, derived complex type by using the type loader.
  var MyProduct = typeLoader.resolveType({
    base: "complex" // optional
    props: [
      {name: "id",    label: "Id",    valueType: "string"},
      {name: "name",  label: "Name",  valueType: "string"},
      {name: "price", label: "Price", valueType: "number"}
    ]
  });

  var productA = new MyProduct({id: "mabc", name: "Principia Mathematica", price: 1200});

  // ...

});
A list type shorthand specification array

A shorter specification syntax to reference the List type, or derived list types of varied element types.

Example:

require(["pentaho/type/loader"], function(typeLoader) {

  // Obtain the List type instance constructor

  // Using the id
  var ListA = typeLoader.resolveType("list");

  // Obtain a derived List type instance constructor
  // with Number as the element type

  // Using the generic type specification syntax
  var NumberListA = typeLoader.resolveType({base: "list", of: "number"});

  // Using the shorthand syntax
  var NumberListB = typeLoader.resolveType(["number"]);

  // ...

  // Assuming the type MyProduct from a previous example

  var ProductList = typeLoader.resolveType([MyProduct]);

  var productList = new ProductList([
    {id: "mpma", name: "Principia Mathematica", price: 1200},
    {id: "flot", name: "The Laws of Thought",   price:  500}
  ]);

  alert("Product count: " + productList.count);

});

Source: doc-js/pentaho/type/spec/TypeReference.jsdoc, line 17

Value:  pentaho.type.spec.IValue | pentaho.type.spec.Element | pentaho.type.spec.List | Nully

A spec.Value represents the union of JS types that can be used to describe a value instance.

When a value instance is described using object form, its specification is of type spec.IValue.

To describe an absent instance, use a Nully JavaScript value.

Source: doc-js/pentaho/type/spec/Value.jsdoc, line 17