new DynamicEnum()
- Description:
Represents a
baja:DynamicEnumin BajaScript.DynamicEnumstores an ordinal state variable as
aNumber. An instance ofEnumRangemay be used to specify the range.When creating a
Simple, always use themake()method instead of
creating a new Object.
- Source:
Extends
Members
(static) DEFAULT :baja.DynamicEnum
- Description:
Default DynamicEnum instance.
- Source:
Default DynamicEnum instance.
Type:
Methods
decodeAsync(str, batchopt) → {Promise.<string>}
- Description:
Asynchronously decode a
DynamicEnumfrom a string, including importing
any type spec encoded in the range.
- Source:
- Overrides:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
str |
string | ||
batch |
baja.comm.Batch |
<optional> |
Returns:
- Type
- Promise.<string>
decodeFromString(str, paramsopt) → {baja.DynamicEnum}
- Description:
Decode a
DynamicEnumfrom aString.
- Source:
- Overrides:
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
str |
String | ||||||||||||
params |
Object |
<optional> |
Properties
|
Returns:
- Type
- baja.DynamicEnum
encodeToString() → {String}
- Description:
Encode a
DynamicEnumto aString.
- Source:
- Overrides:
Returns:
- Type
- String
equals(obj) → {Boolean}
- Description:
Equality test.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
Returns:
- Type
- Boolean
equivalent(obj) → {Boolean}
- Description:
Equivalence test.
equivalent()is used to compare if two Objects have equivalent
state, but might not want to return true for equals since it
it has implied semantics for many operations. The default
implementation returns the result of baja.Object#equals.
- Source:
- Inherited From:
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
Returns:
- Type
- Boolean
get(arg) → {baja.DynamicEnum}
- Description:
Get the enum for the specified tag or ordinal.
This method is used to access an enum based upon a tag or ordinal.
- Source:
- Since:
- Niagara 4.6
Parameters:
| Name | Type | Description |
|---|---|---|
arg |
String | Number | baja.Simple | a tag or ordinal (any |
Throws:
-
if the tag or ordinal is invalid.
- Type
- Error
Returns:
the enum for the tag or ordinal.
- Type
- baja.DynamicEnum
getAgents(isopt, batchopt) → {Promise}
- Description:
Returns a promise that resolves to the agent list for this Object.
- Source:
- Inherited From:
- See:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
is |
Array.<String> |
<optional> |
An optional array of filters to add to the |
batch |
baja.comm.Batch |
<optional> |
An optional object used to batch network |
Returns:
A promise that will resolve with the Agent Info.
- Type
- Promise
getDataTypeSymbol() → {String}
- Description:
Return the data type symbol.
- Source:
Returns:
the data type symbol.
- Type
- String
getEnum() → {baja.Enum}
- Description:
Return the
Enum(itself).
- Source:
- Inherited From:
Returns:
- Type
- baja.Enum
getIcon() → {baja.Icon}
- Description:
Return the Object's Icon.
- Source:
- Inherited From:
Returns:
- Type
- baja.Icon
getOrdinal() → {Number}
- Description:
Return the ordinal.
- Source:
Returns:
the ordinal.
- Type
- Number
getRange() → {baja.EnumRange}
- Description:
Return the range.
- Source:
Returns:
the enum range.
- Type
- baja.EnumRange
getTag() → {String}
- Description:
Return the tag for the ordinal.
- Source:
Returns:
the tag.
- Type
- String
getType() → {Type}
- Description:
Get the type of this instance.
- Source:
- Inherited From:
Returns:
- Type
- Type
getTypeDisplayName(cxopt) → {Promise.<string>|string}
- Description:
Gets the friendly type display name for this object.
- Source:
- Since:
- Niagara 4.10
- Inherited From:
- See:
-
- baja.Type#getDisplayName
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
cx |
Object |
<optional> |
a context to be passed down to Type |
Returns:
If no context is provided, the type
display name is returned synchronously as a string. If context provided,
the type display name is resolved via a promise as a string.
- Type
- Promise.<string> | string
is(arg) → {Boolean}
- Description:
Equals comparison via tag or ordinal.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg |
String | Number | baja.DynamicEnum | the enum, tag or ordinal used for comparison. |
Returns:
true if equal.
- Type
- Boolean
isActive() → {Boolean}
- Description:
Return whether the enum is active or not.
- Source:
Returns:
true if active.
- Type
- Boolean
make(objopt) → {baja.DynamicEnum}
- Description:
Make a DynamicEnum.
- Source:
- Overrides:
Example
// An ordinal or an Object Literal can be used for the method's arguments...
var de1 = baja.$("baja:DynamicEnum").make(0); // Just with an ordinal
//... or with an Object Literal...
var de2 = baja.$("baja:DynamicEnum").make({ordinal: 0, range: enumRange});
//...or create from another enumeration...
var de3 = baja.$("baja:DynamicEnum").make({en: anEnum});
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
obj |
Object | Number |
<optional> |
the Object Literal for the method's arguments or an ordinal. Properties
|
Returns:
the DynamicEnum.
- Type
- baja.DynamicEnum
newCopy(exactopt)
- Description:
Every value may be cloned using the
newCopymethod.Please note that
Simples are immutable so they don't
allocate a new instance.
- Source:
- Inherited From:
- See:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
exact |
Boolean |
<optional> |
true if an exact copy of the value should be |
Returns:
a copy of the value (or the same instance if the value is a
Simple).
toString(cxopt) → {String|Promise.<String>}
- Description:
Return the String representation of the DynamicEnum.
- Source:
- Overrides:
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
cx |
Object |
<optional> |
Properties
|
Returns:
a string representation of this
DynamicEnum (Promise if context given; String if no context given)
valueOf() → {Number}
- Description:
Return the ordinal of the
Enum(itself).
- Source:
- Inherited From:
Returns:
- Type
- Number
(static) make(objopt) → {baja.DynamicEnum}
- Description:
Make a
DynamicEnum.
- Source:
Example
//An ordinal or an Object Literal can be used for the method's arguments...
var de1 = baja.DynamicEnum.make(0); // Just with an ordinal
//... or with an Object Literal...
var de2 = baja.DynamicEnum.make({ordinal: 0, range: enumRange});
//...or create from another enumeration...
var de3 = baja.DynamicEnum.make({en: anEnum});
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
obj |
Object | Number |
<optional> |
the Object Literal for the method's arguments or an ordinal. Properties
|
Returns:
the DynamicEnum.
- Type
- baja.DynamicEnum