private BindHandler getBindHandler() { BindHandler handler = BindHandler.DEFAULT; if (isIgnoreInvalidFields()) { handler = new IgnoreErrorsBindHandler(handler); } if (!isIgnoreUnknownFields()) { UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter(); handler = new NoUnboundElementsBindHandler(handler, filter); } return handler; } }
private BindHandler getBindHandler(ConfigurationProperties annotation, List<Validator> validators) { BindHandler handler = new IgnoreTopLevelConverterNotFoundBindHandler(); if (annotation.ignoreInvalidFields()) { handler = new IgnoreErrorsBindHandler(handler); } if (!annotation.ignoreUnknownFields()) { UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter(); handler = new NoUnboundElementsBindHandler(handler, filter); } if (!validators.isEmpty()) { handler = new ValidationBindHandler(handler, validators.toArray(new Validator[0])); } for (ConfigurationPropertiesBindHandlerAdvisor advisor : getBindHandlerAdvisors()) { handler = advisor.apply(handler); } return handler; }
public <T> BindResult<T> bind(String prefix, Bindable<T> target) { UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter(); NoUnboundElementsBindHandler handler = new NoUnboundElementsBindHandler(new IgnoreTopLevelConverterNotFoundBindHandler(), filter); return binder.bind(prefix, target, handler); }
private BindHandler getBindHandler() { BindHandler handler = BindHandler.DEFAULT; if (isIgnoreInvalidFields()) { handler = new IgnoreErrorsBindHandler(handler); } if (!isIgnoreUnknownFields()) { UnboundElementsSourceFilter filter = new UnboundElementsSourceFilter(); handler = new NoUnboundElementsBindHandler(handler, filter); } return handler; } }
@Override public void preInit(SpringProcessEngineConfiguration springProcessEngineConfiguration) { GenericProperties genericProperties = camundaBpmProperties.getGenericProperties(); final Map<String, Object> properties = genericProperties.getProperties(); if (!CollectionUtils.isEmpty(properties)) { ConfigurationPropertySource source = new MapConfigurationPropertySource(properties); Binder binder = new Binder(source); try { if (genericProperties.isIgnoreUnknownFields()) { binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration)); } else { binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration), new NoUnboundElementsBindHandler(BindHandler.DEFAULT)); } } catch (Exception e) { throw LOG.exceptionDuringBinding(e.getMessage()); } logger.debug("properties bound to configuration: {}", genericProperties); } }
@Override public void preInit(SpringProcessEngineConfiguration springProcessEngineConfiguration) { GenericProperties genericProperties = camundaBpmProperties.getGenericProperties(); final Map<String, Object> properties = genericProperties.getProperties(); if (!CollectionUtils.isEmpty(properties)) { ConfigurationPropertySource source = new MapConfigurationPropertySource(properties); Binder binder = new Binder(source); try { if (genericProperties.isIgnoreUnknownFields()) { binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration)); } else { binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(springProcessEngineConfiguration), new NoUnboundElementsBindHandler(BindHandler.DEFAULT)); } } catch (Exception e) { throw LOG.exceptionDuringBinding(e.getMessage()); } logger.debug("properties bound to configuration: {}", genericProperties); } }