new Enum(enumType)
Creates enumeration data type definition.
Parameters:
Name | Type | Description |
---|---|---|
enumType |
bo.system.Enumeration | The type of the enumeration. |
Extends
Members
-
<readonly> name :string
-
The name of the enumeration type.
Type:
- string
-
<readonly> type :bo.system.Enumeration
-
Gets the type of the enumeration.
Type:
Methods
-
hasValue(value) → {boolean}
-
Checks if value is the defined enumeration and is not null.
Parameters:
Name Type Description value
* The value to check.
Returns:
True if the value is the defined enumeration and not null, otherwise false.
- Type
- boolean
-
<virtual> isValid(value) → {*}
-
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.
Parameters:
Name Type Argument Description value
* <optional>
The value to check.
- Inherited From:
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.
- Type
- *
-
parse(value) → {*}
-
Checks if value is a Enum data. Its value must be one of the defined enumeration values or null.
Parameters:
Name Type Description value
* The value to check.
Returns:
The Enum value or null when the input value is valid, otherwise undefined.
- Type
- *