class SelectorOptionsProvider implements SystemSelectorDataProvider {

    @Override
    public SelectorData getSelectorData(FormRenderingContext context) {
        SelectorData data = new SelectorData<>();

        Map<Object, String> values = new HashMap<>();

        Object selectedValue = null;

        if (context.getModel() instanceof SelectorFieldBaseDefinition) {
            SelectorFieldBaseDefinition selector = (SelectorFieldBaseDefinition) context.getModel();
            selectedValue = selector.getDefaultValue();
            List<SelectorOption> options = selector.getOptions();
            options.forEach(option -> values.put(option.getValue(),
                                                 option.getText()));

            if (!values.containsKey(selectedValue)) {
                selectedValue = null;
                selector.setDefaultValue(null);
            }
        }

        data.setValues(values);
        data.setSelectedValue(selectedValue);
        return data;
    }

}