public class BindingContext extends Object
Model
with controller-specific attributes.
Provides methods to create a WebExchangeDataBinder
for a specific
target, command Object to apply data binding and validation to, or without a
target Object for simple type conversion from request values.
Container for the default model for the request.
Constructor and Description |
---|
BindingContext()
Create a new
BindingContext . |
BindingContext(WebBindingInitializer initializer)
Create a new
BindingContext with the given initializer. |
Modifier and Type | Method and Description |
---|---|
WebExchangeDataBinder |
createDataBinder(ServerWebExchange exchange,
Object target,
String name)
Create a
WebExchangeDataBinder to apply data binding and
validation with on the target, command object. |
WebExchangeDataBinder |
createDataBinder(ServerWebExchange exchange,
String name)
Create a
WebExchangeDataBinder without a target object for type
conversion of request values to simple types. |
Model |
getModel()
Return the default model.
|
protected WebExchangeDataBinder |
initDataBinder(WebExchangeDataBinder binder,
ServerWebExchange exchange)
Initialize the data binder instance for the given exchange.
|
public BindingContext()
BindingContext
.public BindingContext(@Nullable WebBindingInitializer initializer)
BindingContext
with the given initializer.initializer
- the binding initializer to apply (may be null
)public Model getModel()
public WebExchangeDataBinder createDataBinder(ServerWebExchange exchange, @Nullable Object target, String name)
WebExchangeDataBinder
to apply data binding and
validation with on the target, command object.exchange
- the current exchangetarget
- the object to create a data binder forname
- the name of the target objectServerErrorException
- if @InitBinder
method invocation failsprotected WebExchangeDataBinder initDataBinder(WebExchangeDataBinder binder, ServerWebExchange exchange)
ServerErrorException
- if @InitBinder
method invocation failspublic WebExchangeDataBinder createDataBinder(ServerWebExchange exchange, String name)
WebExchangeDataBinder
without a target object for type
conversion of request values to simple types.exchange
- the current exchangename
- the name of the target objectServerErrorException
- if @InitBinder
method invocation fails