Type

Type

new Type(typeSpec, superType, interfaces, data)

Description:
  • A BajaScript Type.

    This Constructor shouldn't be invoked directly.

    Type is an inner class. To access a Type please use baja.lt.

Source:
Parameters:
Name Type Description
typeSpec String
superType String
interfaces Array.<String>
data Object

Extends

Methods

equals(obj) → {Boolean}

Description:
  • Test for equality.

Source:
Overrides:
Parameters:
Name Type Description
obj

value to test for equality.

Returns:
Type
Boolean

getDisplayName(cxopt) → {Promise.<string>|string}

Description:
  • Resolves to the type display name for this type.

    Attempts to look up the lexicon value for the given type if context is
    provided. If not found, the display name is given as the type name with
    spaces added between words based upon capital letters.

    If no context provided, it will return the friendly version of the type
    name.

Source:
Parameters:
Name Type Attributes Description
cx Object <optional>
Returns:
Type
Promise.<string> | string

getIcon() → {baja.Icon}

Description:
  • Return the Type's Icon.

Source:
Returns:
Type
baja.Icon

getInstance()

Description:
  • Return an instance of the Type.

    A Type may have an Function Constructor associated with it. If a Constructor
    is found with this Type, it is used to return an instance.

    If a Constructor can't be found on this Type, then the Super Types
    are inspected and the first Constructor found is used instead.
    This provides an elegant 'dynamic typing' mechanism whereby a
    Constructor is not needed for every single Type.

    If the Type is a concrete Simple or Singleton, then the
    DEFAULT property on the constructor is returned.

Source:
Throws:

if an instance of the Type can't be created
(e.g. if the Type is an interface, is abstract, or if no
constructor can be found).

Type
Error
Returns:

instance of Type.

getInterfaces() → {Array}

Description:
  • Return an array of interfaces Types implemented by this Type.

Source:
Returns:

an array of interface types (all Type)

Type
Array

getModuleName() → {String}

Description:
  • Return the Module Name for the Type.

Source:
Returns:

module name.

Type
String

getSuperType() → {Type}

Description:
  • Return the Super Type.

Source:
Returns:

Super Type or null if not available

Type
Type

getTypeName() → {String}

Description:
  • Return the Type Name for the Type.

Source:
Returns:

type name.

Type
String

getTypeSpec() → {String}

Description:
  • Return the full Type Specification for the Type (moduleName:typeName).

Source:
Returns:

type spec.

Type
String

is(type) → {Boolean}

Description:
  • Test if one Type is another.

Source:
Parameters:
Name Type Description
type String | Type

this can be an instance of a Type object
or a String type specification (module:typeName). When passing a string,
it's not necessary to import the Type before calling this function.

Returns:

true if this Type polymorphically matches the other.

Type
Boolean

isAbstract() → {Boolean}

Description:
  • Return true if Type is Abstract.

Source:
Returns:
Type
Boolean

isAction() → {Boolean}

Description:
  • Return true if the Type is a baja:Action.

Source:
Returns:
Type
Boolean

isComplex() → {Boolean}

Description:
  • Return true if the Type is a Complex.

Source:
Returns:
Type
Boolean

isComponent() → {Boolean}

Description:
  • Return true if the Type is a Component.

Source:
Returns:
Type
Boolean

isFrozenEnum() → {Boolean}

Description:
  • Return true if the Type is a baja:FrozenEnum.

Source:
Returns:
Type
Boolean

isInterface() → {Boolean}

Description:
  • Return true if Type is an Interface.

Source:
Returns:
Type
Boolean
Description:
  • Return true if the Type is a Link.

Source:
Returns:
Type
Boolean

isNumber() → {Boolean}

Description:
  • Return true if the Type is a Number.

Source:
Returns:
Type
Boolean

isOrdScheme() → {Boolean}

Description:
  • Return true if the Type is a baja:OrdScheme.

Source:
Returns:
Type
Boolean

isSimple() → {Boolean}

Description:
  • Return true if the Type is a Simple.

Source:
Returns:
Type
Boolean

isSingleton() → {Boolean}

Description:
  • Return true if the Type is a Singleton.

Source:
Returns:
Type
Boolean

isStruct() → {Boolean}

Description:
  • Return true if the Type is a Struct.

Source:
Returns:
Type
Boolean

isTopic() → {Boolean}

Description:
  • Return true if the Type is a baja:Topic.

Source:
Returns:
Type
Boolean

isTransient() → {Boolean}

Description:
  • Return true if Type is transient.

Source:
Returns:
Type
Boolean

isValue() → {Boolean}

Description:
  • Return true if the Type is a Value.

Source:
Returns:
Type
Boolean

toString() → {String}

Description:
  • Return type spec as toString (moduleName:typeName).

Source:
Returns:

type spec

Type
String

valueOf() → {*}

Description:
  • Return the inner value of the object.

    By default the object's instance is returned.

Source:
Inherited From:
Returns:

the inner value of the object or just the object's instance.

Type
*