org.springframework.boot.context.properties.bind.BindContext Java Examples
The following examples show how to use
org.springframework.boot.context.properties.bind.BindContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EncodingDecodingBindAdviceHandler.java From spring-cloud-stream-binder-kafka with Apache License 2.0 | 6 votes |
@Override public BindHandler apply(BindHandler bindHandler) { BindHandler handler = new AbstractBindHandler(bindHandler) { @Override public <T> Bindable<T> onStart(ConfigurationPropertyName name, Bindable<T> target, BindContext context) { final String configName = name.toString(); if (configName.contains("use") && configName.contains("native") && (configName.contains("encoding") || configName.contains("decoding"))) { BindResult<T> result = context.getBinder().bind(name, target); if (result.isBound()) { if (configName.contains("encoding")) { EncodingDecodingBindAdviceHandler.this.encodingSettingProvided = true; } else { EncodingDecodingBindAdviceHandler.this.decodingSettingProvided = true; } return target.withExistingValue(result.get()); } } return bindHandler.onStart(name, target, context); } }; return handler; }
Example #2
Source File: BindingHandlerAdvise.java From spring-cloud-stream with Apache License 2.0 | 6 votes |
@Override public BindHandler apply(BindHandler bindHandler) { BindHandler handler = new AbstractBindHandler(bindHandler) { @Override public <T> Bindable<T> onStart(ConfigurationPropertyName name, Bindable<T> target, BindContext context) { ConfigurationPropertyName defaultName = getDefaultName(name); if (defaultName != null) { BindResult<T> result = context.getBinder().bind(defaultName, target); if (result.isBound()) { return target.withExistingValue(result.get()); } } return bindHandler.onStart(name, target, context); } }; return handler; }
Example #3
Source File: ThrowErrorBindHandler.java From mango-spring-boot-starter with Apache License 2.0 | 4 votes |
@Override public Object onFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Exception error) throws Exception { throw new MangoAutoConfigException(error); }