类 AbstractBindHandler
java.lang.Object
org.springframework.boot.context.properties.bind.AbstractBindHandler
- 所有已实现的接口:
BindHandler
- 直接已知子类:
BoundPropertiesTrackingBindHandler
,IgnoreErrorsBindHandler
,IgnoreTopLevelConverterNotFoundBindHandler
,NoUnboundElementsBindHandler
,ValidationBindHandler
Abstract base class for
BindHandler
implementations.- 从以下版本开始:
- 2.0.0
- 作者:
- Phillip Webb, Madhura Bhave
-
字段概要
从接口继承的字段 org.springframework.boot.context.properties.bind.BindHandler
DEFAULT
-
构造器概要
构造器构造器说明Create a new binding handler instance.AbstractBindHandler
(BindHandler parent) Create a new binding handler instance with a specific parent. -
方法概要
修饰符和类型方法说明onFailure
(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).void
onFinish
(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.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.boot.context.properties.bind.BindHandler
onCreate
-
构造器详细资料
-
AbstractBindHandler
public AbstractBindHandler()Create a new binding handler instance. -
AbstractBindHandler
Create a new binding handler instance with a specific parent.- 参数:
parent
- the parent handler
-
-
方法详细资料
-
onStart
public <T> Bindable<T> onStart(ConfigurationPropertyName name, Bindable<T> target, BindContext context) 从接口复制的说明:BindHandler
Called when binding of an element starts but before any result has been determined.- 指定者:
onStart
在接口中BindHandler
- 类型参数:
T
- the bindable source type- 参数:
name
- the name of the element being boundtarget
- the item being boundcontext
- the bind context- 返回:
- the actual item that should be used for binding (may be
null
)
-
onSuccess
public Object onSuccess(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) 从接口复制的说明:BindHandler
Called when binding of an element ends with a successful result. Implementations may change the ultimately returned result or perform addition validation.- 指定者:
onSuccess
在接口中BindHandler
- 参数:
name
- the name of the element being boundtarget
- the item being boundcontext
- the bind contextresult
- the bound result (nevernull
)- 返回:
- the actual result that should be used (may be
null
)
-
onFailure
public Object onFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Exception error) throws Exception 从接口复制的说明:BindHandler
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). Implementations may choose to swallow exceptions and return an alternative result.- 指定者:
onFailure
在接口中BindHandler
- 参数:
name
- the name of the element being boundtarget
- the item being boundcontext
- the bind contexterror
- the cause of the error (if the exception stands it may be re-thrown)- 返回:
- the actual result that should be used (may be
null
). - 抛出:
Exception
- if the binding isn't valid
-
onFinish
public void onFinish(ConfigurationPropertyName name, Bindable<?> target, BindContext context, Object result) throws Exception 从接口复制的说明:BindHandler
Called 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)
.- 指定者:
onFinish
在接口中BindHandler
- 参数:
name
- the name of the element being boundtarget
- the item being boundcontext
- the bind contextresult
- the bound result (may benull
)- 抛出:
Exception
- if the binding isn't valid
-