class staticbo.dataTypes. Enum
Source: data-types/
Provide methods to work with enumeration data.
new Enum(enumType)
Creates enumeration data type definition.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
enumType |
|
The type of the enumeration. |
- Extends
- bo.dataTypes.DataType
Properties
read-onlyname
string
The name of the enumeration type.
read-onlytype
bo.system.Enumeration
Gets the type of the enumeration.
Methods
hasValue(value) → boolean
Checks if value is the defined enumeration and is not null.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
value |
any type |
|
The value to check. |
- Returns
-
boolean
True if the value is the defined enumeration and not null, otherwise false.
abstractisValid([value]) → any type
Abstract method to check if the value conforms to the data type definition. Returns the value when it has the required data type. If not, but it can be converted into the required data type, then returns the converted value. Otherwise returns undefined to mark the value as invalid.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
value |
|
Yes |
The value to check. |
- Inherited from
- bo.dataTypes.DataType#isValid
- Throws
-
Not implemented error: The DataType.check method is not implemented.
- Returns
-
The value in the defined data type or null when the value is valid, otherwise undefined.
parse(value) → any type
Checks if value is a Enum data. Its value must be one of the defined enumeration values or null.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
value |
any type |
|
The value to check. |
- Returns
-
any type
The Enum value or null when the input value is valid, otherwise undefined.