Skip to content

Data Dictionary

Dictionaries hold simple key-value data that changes often: ethnicity, country, order status, lead source, HTTP method. Moving them out of enums in code and into a dictionary lets operations staff add and edit options themselves, with no release.

Structure

Two levels:

LevelFieldDescription
DictionaryCodeUnique key, referenced from code to load the whole option set
Name / RemarkPurpose
Dict ItemCodeUnique within the dictionary, recommended as the stored value
NameDisplay text
ValueExtra payload such as a color or number
SortOrder in the dropdown

Open Dict Item from the row operation on the dictionary list. Dictionaries export; items import and export, which makes moving them between environments easy.

As Dropdown Options

Reference the dictionary code through ChoiceType.fetchHandler in @Edit, and the field renders as a dropdown fed live from the dictionary:

java
@EruptField(
    views = @View(title = "Lead Source"),
    edit = @Edit(
        title = "Lead Source",
        type = EditType.CHOICE,
        choiceType = @ChoiceType(
            fetchHandler = DictCodeChoiceFetchHandler.class,
            fetchHandlerParams = "customer_source"   // dictionary code
        )
    )
)
private String source;
HandlerValue stored
DictCodeChoiceFetchHandlerItem code (recommended, immune to id changes)
DictChoiceFetchHandlerItem id

Options are cached; a second entry in fetchHandlerParams sets the cache time in milliseconds. Multi-select fields work the same way, see CHOICE → Dictionary options.

Contributors

The avatar of contributor named as YuePeng YuePeng
The avatar of contributor named as Claude Opus 5 (1M context) Claude Opus 5 (1M context)

Changelog

Released under the Apache-2.0 License.