reference.language.category_enumerations.html Maven / Gradle / Ivy
Enumerations
Category enumerations
An enumeration is a list of names for constant values of a particular type.
Enumerations are practical to refer to values using symbols, rather than provide the same value again and again in your code.
Prompto supports enumerations of both built-in and category types.
This section describes enumerations of category types.
Enumerated symbols are global definitions. You cannot redefine the above name MOTORBIKE elsewhere.
Enumeration symbols must be composed of uppercase letters, digits and '_' only. The first character cannot be a digit.
This makes it easy to recognize enumerated symbols at first glance.
Once an enumerated symbol is defined, it can be used anywhere in place of the value itself.
Enumeration attributes
On top of their category attributes, category enumeration values have the following attributes:
name: returns the name of the enumerated symbol as a Text value
The enumeration itself has the following attributes:
symbols: returns a List of the symbols in the enumeration
Enumeration methods
Category enumerations do not directly support methods. However, they can be derived from existing categories, making it easy to provide custom methods.
In the below example, we:
- define a 'MobileDevice' category with a 'printSpeed' method
- define a 'Vehicle' enumeration which derives from 'MobileDevice'
- call the 'printSpeed' method on an enumerated instance
Enumerations of built-in types
Prompto supports Enumerations of built-in types. See Enumerations for details.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy