class SelectorFieldInitilizer implements FieldInitializer<SelectorFieldBaseDefinition> {

    @Override
    public void initialize(SelectorFieldBaseDefinition selectorFieldBaseDefinition,
                           FieldElement fieldElement,
                           FormGenerationContext context) {
        String dataProvider = fieldElement.getParams().get(SelectorDataProvider.class.getName());

        if (dataProvider != null && !dataProvider.isEmpty()) {
            selectorFieldBaseDefinition.setDataProvider(dataProvider);
        }

        String relatedField = fieldElement.getParams().get("relatedField");

        if (relatedField != null) {
            selectorFieldBaseDefinition.setRelatedField(relatedField);
        }
    }

}