public interface BindHandler
binding
.Modifier and Type | Field and Description |
---|---|
static BindHandler |
DEFAULT
Default no-op bind handler.
|
Modifier and Type | Method and Description |
---|---|
default java.lang.Object |
onCreate(ConfigurationPropertyName name,
Bindable<?> target,
BindContext context,
java.lang.Object result)
Called when binding of an element ends with an unbound result and a newly created
instance is about to be returned.
|
default java.lang.Object |
onFailure(ConfigurationPropertyName name,
Bindable<?> target,
BindContext context,
java.lang.Exception error)
Called when binding fails for any reason (including failures from
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) or 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). |
default void |
onFinish(ConfigurationPropertyName name,
Bindable<?> target,
BindContext context,
java.lang.Object result)
Called when binding finishes with either bound or unbound result.
|
default <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.
|
default java.lang.Object |
onSuccess(ConfigurationPropertyName name,
Bindable<?> target,
BindContext context,
java.lang.Object result)
Called when binding of an element ends with a successful result.
|
static final BindHandler DEFAULT
default <T> Bindable<T> onStart(ConfigurationPropertyName name, Bindable<T> target, BindContext context)
T
- the bindable source typename
- the name of the element being boundtarget
- the item being boundcontext
- the bind contextnull
)default java.lang.Object onSuccess(ConfigurationPropertyName name, Bindable<?> target, BindContext context, java.lang.Object result)
name
- the name of the element being boundtarget
- the item being boundcontext
- the bind contextresult
- the bound result (never null
)null
)default java.lang.Object onCreate(ConfigurationPropertyName name, Bindable<?> target, BindContext context, java.lang.Object result)
name
- the name of the element being boundtarget
- the item being boundcontext
- the bind contextresult
- the newly created instance (never null
)null
)default java.lang.Object onFailure(ConfigurationPropertyName name, Bindable<?> target, BindContext context, java.lang.Exception error) throws java.lang.Exception
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)
or 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.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)null
).java.lang.Exception
- if the binding isn't validdefault void onFinish(ConfigurationPropertyName name, Bindable<?> target, BindContext context, java.lang.Object result) throws java.lang.Exception
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)
.name
- the name of the element being boundtarget
- the item being boundcontext
- the bind contextresult
- the bound result (may be null
)java.lang.Exception
- if the binding isn't valid