Skip to main content

Enum Types

Enum Types are an experimental extension of the elements metamodel. They allow you to create ValueTypes for which the possible values are enumerated in the model.

Enum-types are split into 2 expander bundles. Use the enum-type-rest-expanders if you want to integrate with the rest-expanders.

net.democritus.experimental.enumtypes:enum-type-expanders::0.0.2 net.democritus.experimental.enumtypes:enum-type-rest-expanders::0.0.2

Defining EnumType

EnumTypes are defined in a Component. In the Component model directory, add your EnumType models under valueTypes.

E.g. this describes a FileChangeType enum:

<valueType name="FileChangeType" type="enumTypeElements::EnumType">
<enumValueType name="ADD">
<description>File was created</description>
<enumValueType name="MODIFY">
<description>File was updated</description>
<enumValueType name="DELETE">
<description>Files was removed</description>
<enumValueType name="RENAME">
<description>File was moved or renamed</description>
<enumValueType name="COPY">
<description>File is a copy from another file</description>

The ValueType can then be used as target for ValueField#type:

<field name="changeType">
<type name="FileChangeType"/>

You can use the defaultValue option on a Field to define one of the enums as initial value:

<field name="changeType">
<type name="FileChangeType"/>

Known Issues

  • EnumTypes do not work with the isRequired option of the REST-expanders on the enum field. This option generates a test that does not compile, because it is not yet implemented for ValueTypes.
  • When changing a field to the new EnumType, also update the commands for the REST API's, otherwise it will not compile.
  • You will have to use at least version 1.15.9 of the micro-radiant, otherwise your project will not be able to load.

Missing Integrations

  • Angular-expanders
  • Knockout UI