use of org.talend.components.service.rest.DefinitionTypeConverter in project components by Talend.
the class ControllersConfiguration method initBinder.
/**
* Initialise Web binders to be able to use {@link PropertyTrigger} in camel case in {@link PathVariable}.
*/
@InitBinder
protected void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(PropertyTrigger.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text) throws IllegalArgumentException {
String upperUnderscoreCased = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_UNDERSCORE).convert(text);
PropertyTrigger propertyTrigger = PropertyTrigger.valueOf(upperUnderscoreCased);
setValue(propertyTrigger);
}
});
binder.registerCustomEditor(DefinitionType.class, new DefinitionTypeConverter());
binder.registerCustomEditor(ConnectorTypology.class, new ConnectorTypologyConverter());
}
Aggregations