Constructor
new EnumBase()
Base class for all enum likes
Methods
getEnumName() → {String}
Gets the name of the Enum class.
getValue(valueOrLabel) → {String}
Gets the enum value of the provided value or label value. Case sensitive for values, case insensitive for labels.
Parameters:
Name | Type | Description |
---|---|---|
valueOrLabel
|
String | The value or the label. |
If the valueOrLabel args is not a value or a label.
The enum value for the provided value or label.
hasLabel(testedLabel) → {Boolean}
Checks if the provided label is in the enum.
Parameters:
Name | Type | Description |
---|---|---|
testedLabel
|
String | The label to be checked. |
True if the provided label is in the enum, false otherwise.
hasProperty(testedPropertyName) → {Boolean}
Checks if the provided value is a property of the enum.
Parameters:
Name | Type | Description |
---|---|---|
testedPropertyName
|
String | The searched property. |
True if the provided value is a property of the enum, false otherwise.
hasValue(testedValue) → {Boolean}
Checks if the provided value is an existing value (case sensitive).
Parameters:
Name | Type | Description |
---|---|---|
testedValue
|
String | The value to be checked. |
True if the provided value exists, false otherwise.
hasValueOrLabelOrProperty(valueOrLabelOrProperty) → {Boolean}
Checks if the provided value is in the enum as a label or a value.
Parameters:
Name | Type | Description |
---|---|---|
valueOrLabelOrProperty
|
The value, label or property. |
True if the value, label or property is in the enum as a label or a value, false otherwise.
tryGetValue(valueOrLabel) → {String|null}
Gets the enum value for the provided value or label value. Case sensitive for values, case insensitive for labels.
Parameters:
Name | Type | Description |
---|---|---|
valueOrLabel
|
String | The value or the label. |
The enum value for the provided value or label if exists, otherwise null.