Skip to main content
Pentaho Documentation

Base

pentaho.lang.Base

Base Class for JavaScript Inheritance.

Based on Base.js by Dean Edwards, and later edited by Kenneth Powers.

AMD Module

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

Constructor

Name Description
new Base(spec)

Creates a new Base object.

Classes

Name Summary
Array
Error
Object

Members

Name Description
ancestor
 
Static

The ancestor class.

base : function
 
Protected

If a method has been overridden, then the base method provides access to the overridden method.

Methods

Name Description
_extend(name, instSpec, classSpec, keyArgs) : Class.<pentaho.lang.Base>
 
Static
 
Protected

Actually creates a subclass of this one.

_subclassed(Subclass, instSpec, classSpec, keyArgs)
 
Static
 
Protected

Called when a subclass of this class has been created.

extend(name, instSpec, classSpec, keyArgs) : Class.<pentaho.lang.Base>
 
Static

Creates a subclass of this one.

implement(instSpecs) : !Class.<pentaho.lang.Base> | function
 
Static

Adds instance specifications to this class.

implementStatic(classSpecs) : !Class.<pentaho.lang.Base> | function
 
Static

Adds static specifications to this class.

mix(instSpec, classSpec, keyArgs) : Class.<pentaho.lang.Base>
 
Static

Adds additional members to, or overrides existing ones of, this class.

to(value, other) : pentaho.lang.Base
 
Static

Converts a value to an instance of this class, or throws if that is impossible.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

Constructor Details

new Base(spec)

Creates a new Base object.

If spec is specified, the new object is extended with it.

Source: javascript/web/pentaho/lang/Base.js, line 132

Parameters:
Name Default Value Summary
spec : Object
 
Optional

An extension specification.

Members Details

ancestor:
 
Static

The ancestor class.

Source: javascript/web/pentaho/lang/Base.js, line 287

base: function
 
Protected

If a method has been overridden, then the base method provides access to the overridden method.

Can also be called from within a constructor function.

Source: javascript/web/pentaho/lang/Base.js, line 299

Methods Details

_extend(name, instSpec, classSpec, keyArgs) : Class.<pentaho.lang.Base>
 
Static
 
Protected

Actually creates a subclass of this one.

The default implementation creates the subclass constructor, inherits static members and handles the special instSpec.extend_exclude and instSpec.extend_order properties. Then, it delegates the remainder of the subclass setup to the _subclassed, whose default implementation mixes-in the given instance and class specifications.

Source: javascript/web/pentaho/lang/Base.js, line 425

Parameters:
Name Default Value Summary
name : string

The name of the created class.

instSpec : Object

The instance-side specification.

Parameters:
Name Default Value Summary
extend_order : Array.<string>
 
Optional

An array of instance property names that extend should always apply before other properties and in the given order.

The given property names are appended to any inherited ordered property names.

extend_exclude : Object
 
Optional

A set of property names to exclude, whenever the instance side of the class (through mix or implement) or its instances (through extend) are extended.

The given property names are joined with any inherited excluded property names.

Properties can have any value.

classSpec : Object

The class-side specification.

keyArgs : Object

The keyword arguments.

Returns:
Name Description
Class.<pentaho.lang.Base>

The new subclass.

_subclassed(Subclass, instSpec, classSpec, keyArgs)
 
Static
 
Protected

Called when a subclass of this class has been created.

The default implementation mixes the given instance and class specification in the new subclass, without actually recording a mix operation.

Source: javascript/web/pentaho/lang/Base.js, line 564

Parameters:
Name Default Value Summary
Subclass : function

The created subclass.

instSpec : Object

The instance-side specification.

classSpec : Object

The static-side specification.

keyArgs : Object

The keyword arguments.

extend(name, instSpec, classSpec, keyArgs) : Class.<pentaho.lang.Base>
 
Static

Creates a subclass of this one.

All classes inherit the extend method, so they can also be subclassed.

Inheritance is delegated to the _extend method, which can be overridden.

Source: javascript/web/pentaho/lang/Base.js, line 369

Parameters:
Name Default Value Summary
name : string
 
Optional

The name of the created class. Used for debugging purposes.

instSpec : Object
 
Optional

The instance specification.

Parameters:
Name Default Value Summary
extend_order : Array.<string>
 
Optional

An array of instance property names that extend should always apply before other properties and in the given order.

The given property names are appended to any inherited ordered property names.

extend_exclude : Object
 
Optional

A set of property names to exclude, whenever the instance side of the class (through mix or implement) or its instances (through extend) are extended.

The given property names are joined with any inherited excluded property names.

Properties can have any value.

classSpec : Object
 
Optional

The static specification.

keyArgs : Object
 
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
exclude : Object
 
Optional

A set of property names to exclude, both from the instance and class sides, in this method call. Properties can have any value.

Returns:
Name Description
Class.<pentaho.lang.Base>

The new subclass.

implement(instSpecs) : !Class.<pentaho.lang.Base> | function
 
Static

Adds instance specifications to this class.

This method does not create a new class.

Each instance specification can be a class or an object. When it is a class, only its instance-side is mixed-in.

Source: javascript/web/pentaho/lang/Base.js, line 896

Parameters:
Name Default Value Summary
instSpecs : function | Object

The instance-side specifications to mix-in.

Returns:
Name Description
!Class.<pentaho.lang.Base> | function

This class.

See also:  pentaho.lang.Base.implementStatic , pentaho.lang.Base.mix

implementStatic(classSpecs) : !Class.<pentaho.lang.Base> | function
 
Static

Adds static specifications to this class.

This method does not create a new class.

Each class-side/static specification can be a class or an object. When it is a class, only its class-side is mixed-in.

Source: javascript/web/pentaho/lang/Base.js, line 943

Parameters:
Name Default Value Summary
classSpecs : function | Object

The class-side specifications to mix-in.

Returns:
Name Description
!Class.<pentaho.lang.Base> | function

This class.

mix(instSpec, classSpec, keyArgs) : Class.<pentaho.lang.Base>
 
Static

Adds additional members to, or overrides existing ones of, this class.

This method does not create a new class.

This method supports two signatures:

  1. mix(Class: function[, keyArgs: Object]) - mixes-in the given class, both its instance and class sides.

  2. mix(instSpec: Object[, classSpec: Object[, keyArgs: Object]]) - mixes-in the given instance and class side specifications.

Source: javascript/web/pentaho/lang/Base.js, line 745

Parameters:
Name Default Value Summary
instSpec : function | Object

The class to mixin or the instance-side specification.

classSpec : Object
 
Optional

The class-side specification.

keyArgs : Object
 
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
exclude : Object
 
Optional

A set of property names to exclude, both from the instance and class sides. Properties can have any value.

Returns:
Name Description
Class.<pentaho.lang.Base>

This class.

to(value, other) : pentaho.lang.Base
 
Static

Converts a value to an instance of this class, or throws if that is impossible.

When value is an instance of this type, it is returned.

Otherwise, a new instance of this class is created, using all of the specified arguments as constructor arguments.

Source: javascript/web/pentaho/lang/Base.js, line 676

Parameters:
Name Default Value Summary
value : any

The value to be cast.

other : any
 
Repeatable

Remaining arguments passed alongside value to the class constructor.

Returns:
Name Description
pentaho.lang.Base

The converted value.

Throws:
Name Description
Error

When value cannot be converted.

extend(source, keyArgs) : Object

Extend an object with the properties of another.

Methods that are overridden are accessible through this.base.

This object is extended, but its class doesn't change.

Source: javascript/web/pentaho/lang/Base.js, line 1037

Parameters:
Name Default Value Summary
source : Object

The instance specification.

keyArgs : Object
 
Optional

The keyword arguments.

Parameters:
Name Default Value Summary
exclude : Object
 
Optional

A map of property names to exclude from source.

Returns:
Name Description
Object

This object.