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.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| <inner> |
Type()
|
| 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> |
getFrozenEnum(arg)
Returns the FrozenEnum for the Type (providing the Type maps to a FrozenEnum).
|
|
getIcon()
Return the Types's Icon.
|
|
|
getInstance(arg)
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> |
getRange()
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.
|
|
|
isAction()
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.
|
|
|
isLink()
Return true if the Type is a Link.
|
|
|
isNumber()
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.
|
|
|
isSimple()
Return true if the Type is a Simple.
|
|
|
Return true if the Type is a Singleton.
|
|
|
isStruct()
Return true if the Type is a Struct.
|
|
| <private> |
isTag(tag)
Returns whether the specified tag exists for this FrozenEnum Type.
|
|
isTopic()
Return true if the Type is a baja:Topic.
|
|
|
Return true if Type is transient.
|
|
|
isValue()
Return true if the Type is a Value.
|
|
| <private> |
loadContract(obj)
Ensures the Contract for the given Type is loaded.
|
| <private> |
tagToOrdinal(tag)
Returns the ordinal for the tag (providing the Type maps to a FrozenEnum).
|
|
toString()
Return type spec as toString (moduleName:typeName).
|
- Methods borrowed from class BaseBajaObj:
- valueOf
- Parameters:
- obj
- value to test for equality.
- Returns:
- {Boolean}
- Returns:
- Contract
- 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.
- 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
- Returns:
- {String}
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.
- Returns:
- {Array} an array of interface types (all Type)
- Returns:
- {String} module name.
- Throws:
- error if Type is not a FrozenEnum or if Contract can't be loaded.
- Returns:
- {Array} array of ordinals for frozen enum.
- 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
- Returns:
- {Type} Super Type or null if not available
- 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.
- Returns:
- {String} type name.
- Returns:
- {String} type spec.
- Returns:
- {Boolean}
- Returns:
- {Boolean} true if the Type has a Contract.
- 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.
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- 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.
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- 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.
- Returns:
- {Boolean}
- Returns:
- {Boolean}
- Returns:
- {Boolean}
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.
- 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.
- Returns:
- {String} type spec