Search in sources :

Example 1 with UnboundElementsSourceFilter

use of cn.taketoday.context.properties.source.UnboundElementsSourceFilter in project today-framework by TAKETODAY.

the class ConfigurationPropertiesBinder method getBindHandler.

private <T> BindHandler getBindHandler(Bindable<T> target, ConfigurationProperties annotation) {
    List<Validator> validators = getValidators(target);
    BindHandler handler = getHandler();
    handler = new ConfigurationPropertiesBindHandler(handler);
    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;
}
Also used : IgnoreErrorsBindHandler(cn.taketoday.context.properties.bind.handler.IgnoreErrorsBindHandler) NoUnboundElementsBindHandler(cn.taketoday.context.properties.bind.handler.NoUnboundElementsBindHandler) UnboundElementsSourceFilter(cn.taketoday.context.properties.source.UnboundElementsSourceFilter) ValidationBindHandler(cn.taketoday.context.properties.bind.validation.ValidationBindHandler) BoundPropertiesTrackingBindHandler(cn.taketoday.context.properties.bind.BoundPropertiesTrackingBindHandler) BindHandler(cn.taketoday.context.properties.bind.BindHandler) IgnoreErrorsBindHandler(cn.taketoday.context.properties.bind.handler.IgnoreErrorsBindHandler) IgnoreTopLevelConverterNotFoundBindHandler(cn.taketoday.context.properties.bind.handler.IgnoreTopLevelConverterNotFoundBindHandler) AbstractBindHandler(cn.taketoday.context.properties.bind.AbstractBindHandler) NoUnboundElementsBindHandler(cn.taketoday.context.properties.bind.handler.NoUnboundElementsBindHandler) Validator(cn.taketoday.validation.Validator) ValidationBindHandler(cn.taketoday.context.properties.bind.validation.ValidationBindHandler)

Aggregations

AbstractBindHandler (cn.taketoday.context.properties.bind.AbstractBindHandler)1 BindHandler (cn.taketoday.context.properties.bind.BindHandler)1 BoundPropertiesTrackingBindHandler (cn.taketoday.context.properties.bind.BoundPropertiesTrackingBindHandler)1 IgnoreErrorsBindHandler (cn.taketoday.context.properties.bind.handler.IgnoreErrorsBindHandler)1 IgnoreTopLevelConverterNotFoundBindHandler (cn.taketoday.context.properties.bind.handler.IgnoreTopLevelConverterNotFoundBindHandler)1 NoUnboundElementsBindHandler (cn.taketoday.context.properties.bind.handler.NoUnboundElementsBindHandler)1 ValidationBindHandler (cn.taketoday.context.properties.bind.validation.ValidationBindHandler)1 UnboundElementsSourceFilter (cn.taketoday.context.properties.source.UnboundElementsSourceFilter)1 Validator (cn.taketoday.validation.Validator)1