UML Modeling Guide

Stereotype «JEAFEnumeration»

Stereotype «JEAFEnumeration»

Stereotype «JEAF Enumeration» can be used to model enumerations that should be generated by JEAF Generator.

JEAF Generator also supports so called “extensible enums”. From a semantic versioning perspective added new literals to an enumeration is a breaking change. However in reality this is a quite common case. If you want to avoid the breaking change then you can work with extensible enums. By default for them its not considered to be a breaking change if you add an additional literal.

To support developers in this scenarios JEAF Generator is able to generate extensible enums. In Java, they have an additional fallback literal to which unknown literals will be mapped during JSON deserialization.


Stereotype «JEAFEnumeration»  
Applicable Elements Enumeration  
Tagged Values    
Name Type Description
extensibleEnum Boolean If set to true the enumeration is an extensible enum.

Default value: false
hasCustomImplementation Boolean If set to true then a so called code protection region will be generated. Inside this region custom code for the enum can be added. JEAF Generator will detect such regions and will preserve the code inside.

Default value: false
hasDynamicLiterals Boolean Typically enumeration literals are directly defined on an enumeration in the UML model. However, there might be cases where the literals should be resolved from somewhere else.

For such cases JEAF Generator allows to dynamically resolve literals. Therefore, in addition to setting this tag to true also jeafgenerator/api/JavaEnumerationExtensionPoint.xpt has to be implemented. There the dynamic literals have to be will be added to an enum using template AddDynamicLiterals.

It is also supported to mix model defined and dynamic literals.


For further information please refer to: - How to model Service APIs - Generating Code for Services


Generated by JEAF Generator