Class AbstractBindHandler
java.lang.Object
org.springframework.boot.context.properties.bind.AbstractBindHandler
- All Implemented Interfaces:
- BindHandler
- Direct Known Subclasses:
- BoundPropertiesTrackingBindHandler,- IgnoreErrorsBindHandler,- IgnoreTopLevelConverterNotFoundBindHandler,- NoUnboundElementsBindHandler,- ValidationBindHandler
Abstract base class for 
BindHandler implementations.- Since:
- 2.0.0
- Author:
- Phillip Webb, Madhura Bhave
- 
Field SummaryFields inherited from interface org.springframework.boot.context.properties.bind.BindHandlerDEFAULT
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new binding handler instance.AbstractBindHandler(BindHandler parent) Create a new binding handler instance with a specific parent.
- 
Method SummaryModifier and TypeMethodDescriptiononFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Exception error) Called when binding fails for any reason (including failures fromBindHandler.onSuccess(org.springframework.boot.context.properties.source.ConfigurationPropertyName, org.springframework.boot.context.properties.bind.Bindable<?>, org.springframework.boot.context.properties.bind.BindContext, java.lang.Object)orBindHandler.onCreate(org.springframework.boot.context.properties.source.ConfigurationPropertyName, org.springframework.boot.context.properties.bind.Bindable<?>, org.springframework.boot.context.properties.bind.BindContext, java.lang.Object)calls).voidonFinish(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) Called when binding finishes with either bound or unbound result.<T> Bindable<T>onStart(ConfigurationPropertyName name, Bindable<T> target, BindContext context) Called when binding of an element starts but before any result has been determined.onSuccess(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) Called when binding of an element ends with a successful result.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.context.properties.bind.BindHandleronCreate
- 
Constructor Details- 
AbstractBindHandlerpublic AbstractBindHandler()Create a new binding handler instance.
- 
AbstractBindHandlerCreate a new binding handler instance with a specific parent.- Parameters:
- parent- the parent handler
 
 
- 
- 
Method Details- 
onStartpublic <T> Bindable<T> onStart(ConfigurationPropertyName name, Bindable<T> target, BindContext context) Description copied from interface:BindHandlerCalled when binding of an element starts but before any result has been determined.- Specified by:
- onStartin interface- BindHandler
- Type Parameters:
- T- the bindable source type
- Parameters:
- name- the name of the element being bound
- target- the item being bound
- context- the bind context
- Returns:
- the actual item that should be used for binding (may be null)
 
- 
onSuccesspublic Object onSuccess(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) Description copied from interface:BindHandlerCalled when binding of an element ends with a successful result. Implementations may change the ultimately returned result or perform addition validation.- Specified by:
- onSuccessin interface- BindHandler
- Parameters:
- name- the name of the element being bound
- target- the item being bound
- context- the bind context
- result- the bound result (never- null)
- Returns:
- the actual result that should be used (may be null)
 
- 
onFailurepublic Object onFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Exception error) throws Exception Description copied from interface:BindHandlerCalled when binding fails for any reason (including failures fromBindHandler.onSuccess(org.springframework.boot.context.properties.source.ConfigurationPropertyName, org.springframework.boot.context.properties.bind.Bindable<?>, org.springframework.boot.context.properties.bind.BindContext, java.lang.Object)orBindHandler.onCreate(org.springframework.boot.context.properties.source.ConfigurationPropertyName, org.springframework.boot.context.properties.bind.Bindable<?>, org.springframework.boot.context.properties.bind.BindContext, java.lang.Object)calls). Implementations may choose to swallow exceptions and return an alternative result.- Specified by:
- onFailurein interface- BindHandler
- Parameters:
- name- the name of the element being bound
- target- the item being bound
- context- the bind context
- error- the cause of the error (if the exception stands it may be re-thrown)
- Returns:
- the actual result that should be used (may be null).
- Throws:
- Exception- if the binding isn't valid
 
- 
onFinishpublic void onFinish(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) throws Exception Description copied from interface:BindHandlerCalled when binding finishes with either bound or unbound result. This method will not be called when binding failed, even if a handler returns a result fromBindHandler.onFailure(org.springframework.boot.context.properties.source.ConfigurationPropertyName, org.springframework.boot.context.properties.bind.Bindable<?>, org.springframework.boot.context.properties.bind.BindContext, java.lang.Exception).- Specified by:
- onFinishin interface- BindHandler
- Parameters:
- name- the name of the element being bound
- target- the item being bound
- context- the bind context
- result- the bound result (may be- null)
- Throws:
- Exception- if the binding isn't valid
 
 
-