Class Index | File Index

Classes


Class Type


Extends BaseBajaObj.
A BajaScript Type.

This Constructor shouldn't be invoked directly.

Type is a inner class. To access a Type please use baja.lt.
Defined in: sys.js.

Class Summary
Constructor Attributes Constructor Name and Description
<inner>  
Type()
Method Summary
Method Attributes Method Name and Description
 
equals(obj)
Test for equality.
<private>  
Return the Contract for the Type.
<private>  
getDisplayTag(ordinal)
Returns the display tag for the ordinal (this Type has to map to a FrozenEnum).
<private>  
Returns the FrozenEnum for the Type (providing the Type maps to a FrozenEnum).
 
Return the Types's Icon.
 
Return an instance of the Type.
 
Return an array of interfaces Types implemented by this Type.
 
Return the Module Name for the Type.
<private>  
Returns the ordinals for a Type that maps to a FrozenEnum.
<private>  
Returns the EnumRange for the Type (providing the Type maps to a FrozenEnum).
 
Return the Super Type.
<private>  
getTag(ordinal)
Returns the tag for the ordinal (this Type has to map to a FrozenEnum).
 
Return the Type Name for the Type.
 
Return the full Type Specification for the Type (moduleName:typeName).
<private>  
Return true if this Type has a constructor directly assocated with it.
<private>  
Return true if the Type has a Contract.
 
is(type)
Test one Type is another.
 
Return true if Type is Abstract.
 
Return true if the Type is a baja:Action.
 
Return true if the Type is a Complex.
 
Return true if the Type is a Component.
 
Return true if the Type is a baja:FrozenEnum.
 
Return true if Type is an Interface.
 
Return true if the Type is a Link.
 
Return true if the Type is a Number.
<private>  
isOrdinal(ordinal)
Returns whether the specified ordinal exists for this FrozenEnum Type.
 
Return true if the Type is a baja:OrdScheme.
 
Return true if the Type is a Simple.
 
Return true if the Type is a Singleton.
 
Return true if the Type is a Struct.
<private>  
isTag(tag)
Returns whether the specified tag exists for this FrozenEnum Type.
 
Return true if the Type is a baja:Topic.
 
Return true if Type is transient.
 
Return true if the Type is a Value.
<private>  
Ensures the Contract for the given Type is loaded.
<private>  
Returns the ordinal for the tag (providing the Type maps to a FrozenEnum).
 
Return type spec as toString (moduleName:typeName).
Methods borrowed from class BaseBajaObj:
valueOf
Class Detail
<inner> Type()
Method Detail
{Boolean} equals(obj)
Test for equality.
Parameters:
obj
value to test for equality.
Returns:
{Boolean}

<private> getContract()
Return the Contract for the Type.
Returns:
Contract

<private> {String} getDisplayTag(ordinal)
Returns the display tag for the ordinal (this Type has to map to a FrozenEnum).
Parameters:
{Number} ordinal
Throws:
error if Type is not a FrozenEnum, if Contract can't be loaded or if the ordinal doesn't exist.
Returns:
{String} the display tag for the ordinal.

<private> {FrozenEnum} getFrozenEnum(arg)
Returns the FrozenEnum for the Type (providing the Type maps to a FrozenEnum).
Parameters:
{String|Number} arg
the tag or ordinal for the frozen enum to return.
Throws:
error if Type is not a FrozenEnum, if Contract can't be loaded or the tag or ordinal doesn't exist.
Returns:
{FrozenEnum} the frozen enumeration for the tag or ordinal.
See:
baja.EnumRange

{String} getIcon()
Return the Types's Icon.
Returns:
{String}

getInstance(arg)
Return an instance of the Type.

A Type may have an Function Constructor associated with it. If a Constructor is found with this Type, this it's 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.

Parameters:
arg
Throws:
if an instance of the Type can't be created (i.e. if the Type is an Interface or Abstract or no constructor can be found).
Returns:
instance of Type.

{Array} getInterfaces()
Return an array of interfaces Types implemented by this Type.
Returns:
{Array} an array of interface types (all Type)

{String} getModuleName()
Return the Module Name for the Type.
Returns:
{String} module name.

<private> {Array} getOrdinals()
Returns the ordinals for a Type that maps to a FrozenEnum.
Throws:
error if Type is not a FrozenEnum or if Contract can't be loaded.
Returns:
{Array} array of ordinals for frozen enum.

<private> {baja.EnumRange} getRange()
Returns the EnumRange for the Type (providing the Type maps to a FrozenEnum).
Throws:
error if Type is not a FrozenEnum, if Contract can't be loaded or the tag doesn't exist.
Returns:
{baja.EnumRange} the enum range.
See:
baja.EnumRange

{Type} getSuperType()
Return the Super Type.
Returns:
{Type} Super Type or null if not available

<private> {String} getTag(ordinal)
Returns the tag for the ordinal (this Type has to map to a FrozenEnum).
Parameters:
{Number} ordinal
Throws:
error if Type is not a FrozenEnum, if Contract can't be loaded or if the ordinal doesn't exist.
Returns:
{String} the tag for the ordinal.

{String} getTypeName()
Return the Type Name for the Type.
Returns:
{String} type name.

{String} getTypeSpec()
Return the full Type Specification for the Type (moduleName:typeName).
Returns:
{String} type spec.

<private> {Boolean} hasConstructor()
Return true if this Type has a constructor directly assocated with it.
Returns:
{Boolean}

<private> {Boolean} hasContract()
Return true if the Type has a Contract.
Returns:
{Boolean} true if the Type has a Contract.

{Boolean} is(type)
Test one Type is another.
Parameters:
{String|Type} type
this can be an instance of a Type object or a String type specification (module:typeName).
Returns:
{Boolean} true if this Type polymorphically matches the other.

{Boolean} isAbstract()
Return true if Type is Abstract.
Returns:
{Boolean}

{Boolean} isAction()
Return true if the Type is a baja:Action.
Returns:
{Boolean}

{Boolean} isComplex()
Return true if the Type is a Complex.
Returns:
{Boolean}

{Boolean} isComponent()
Return true if the Type is a Component.
Returns:
{Boolean}

{Boolean} isFrozenEnum()
Return true if the Type is a baja:FrozenEnum.
Returns:
{Boolean}

{Boolean} isInterface()
Return true if Type is an Interface.
Returns:
{Boolean}

{Boolean} isLink()
Return true if the Type is a Link.
Returns:
{Boolean}

{Boolean} isNumber()
Return true if the Type is a Number.
Returns:
{Boolean}

<private> {Boolean} isOrdinal(ordinal)
Returns whether the specified ordinal exists for this FrozenEnum Type.
Parameters:
{Number} ordinal
Throws:
error if Type is not a FrozenEnum or if Contract can't be loaded.
Returns:
{Boolean} true if the ordinal number exists in this FrozenEnum Type.

{Boolean} isOrdScheme()
Return true if the Type is a baja:OrdScheme.
Returns:
{Boolean}

{Boolean} isSimple()
Return true if the Type is a Simple.
Returns:
{Boolean}

{Boolean} isSingleton()
Return true if the Type is a Singleton.
Returns:
{Boolean}

{Boolean} isStruct()
Return true if the Type is a Struct.
Returns:
{Boolean}

<private> {Boolean} isTag(tag)
Returns whether the specified tag exists for this FrozenEnum Type.
Parameters:
{String} tag
Throws:
error if Type is not a FrozenEnum or if Contract can't be loaded.
Returns:
{Boolean} true if the tag exists.

{Boolean} isTopic()
Return true if the Type is a baja:Topic.
Returns:
{Boolean}

{Boolean} isTransient()
Return true if Type is transient.
Returns:
{Boolean}

{Boolean} isValue()
Return true if the Type is a Value.
Returns:
{Boolean}

<private> loadContract(obj)
Ensures the Contract for the given Type is loaded.

If the Contract doesn't exist and this Type is a Complex or a FrozenEnum, a network call will be made to get the Contract.

Parameters:
{Object} obj Optional
Object Literal containing the method's arguments.
{Function} obj.ok Optional
ok function callback. If defined, the network call is automatically made asynchronously otherwise the network call is synchronous.
{Function} obj.fail Optional
fail function callback. If the Contract fails to load, this function will be called.
{baja.comm.Batch} obj.batch Optional
the batch buffer. If defined, the network call will be batched into this object.

<private> {Number} tagToOrdinal(tag)
Returns the ordinal for the tag (providing the Type maps to a FrozenEnum).
Parameters:
{String} tag
Throws:
error if Type is not a FrozenEnum, if Contract can't be loaded or the tag doesn't exist.
Returns:
{Number} ordinal for the tag.

{String} toString()
Return type spec as toString (moduleName:typeName).
Returns:
{String} type spec

Documentation generated by JsDoc Toolkit 2.3.2