Class: Type

Type


new Type(typeSpec, superType, interfaces, data)

A BajaScript Type.

This Constructor shouldn't be invoked directly.

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

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

Extends

Methods


equals(obj)

Test for equality.

Parameters:
Name Type Description
obj

value to test for equality.

Overrides:
Returns:
Type
Boolean

getIcon()

Return the Type's Icon.

Returns:
Type
baja.Icon

getInstance()

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.

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()

Return an array of interfaces Types implemented by this Type.

Returns:

an array of interface types (all Type)

Type
Array

getModuleName()

Return the Module Name for the Type.

Returns:

module name.

Type
String

getSuperType()

Return the Super Type.

Returns:

Super Type or null if not available

Type
Type

getTypeName()

Return the Type Name for the Type.

Returns:

type name.

Type
String

getTypeSpec()

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

Returns:

type spec.

Type
String

is(type)

Test if one Type is another.

Parameters:
Name Type Description
type String | Type

this can be an instance of a Type object
or a String type specification (module:typeName).

Returns:

true if this Type polymorphically matches the other.

Type
Boolean

isAbstract()

Return true if Type is Abstract.

Returns:
Type
Boolean

isAction()

Return true if the Type is a baja:Action.

Returns:
Type
Boolean

isComplex()

Return true if the Type is a Complex.

Returns:
Type
Boolean

isComponent()

Return true if the Type is a Component.

Returns:
Type
Boolean

isFrozenEnum()

Return true if the Type is a baja:FrozenEnum.

Returns:
Type
Boolean

isInterface()

Return true if Type is an Interface.

Returns:
Type
Boolean

Return true if the Type is a Link.

Returns:
Type
Boolean

isNumber()

Return true if the Type is a Number.

Returns:
Type
Boolean

isOrdScheme()

Return true if the Type is a baja:OrdScheme.

Returns:
Type
Boolean

isSimple()

Return true if the Type is a Simple.

Returns:
Type
Boolean

isSingleton()

Return true if the Type is a Singleton.

Returns:
Type
Boolean

isStruct()

Return true if the Type is a Struct.

Returns:
Type
Boolean

isTopic()

Return true if the Type is a baja:Topic.

Returns:
Type
Boolean

isTransient()

Return true if Type is transient.

Returns:
Type
Boolean

isValue()

Return true if the Type is a Value.

Returns:
Type
Boolean

toString()

Return type spec as toString (moduleName:typeName).

Returns:

type spec

Type
String

valueOf()

Return the inner value of the object.

By default the object's instance is returned.

Inherited From:
Returns:

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

Type
*