类 BindingContext
- java.lang.Object
- org.springframework.web.reactive.BindingContext
public class BindingContext extends Object
Context to assist with binding request data onto Objects and provide access to a sharedModel
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.
- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 BindingContext()
Create a newBindingContext
.BindingContext(WebBindingInitializer initializer)
Create a newBindingContext
with the given initializer.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 WebExchangeDataBinder
createDataBinder(ServerWebExchange exchange, Object target, String name)
Create aWebExchangeDataBinder
to apply data binding and validation with on the target, command object.WebExchangeDataBinder
createDataBinder(ServerWebExchange exchange, String name)
Create aWebExchangeDataBinder
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.
构造器详细资料
BindingContext
public BindingContext()
Create a newBindingContext
.
BindingContext
public BindingContext(@Nullable WebBindingInitializer initializer)
Create a newBindingContext
with the given initializer.- 参数:
initializer
- the binding initializer to apply (may benull
)
方法详细资料
createDataBinder
public WebExchangeDataBinder createDataBinder(ServerWebExchange exchange, @Nullable Object target, String name)
Create aWebExchangeDataBinder
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 object- 返回:
- the created data binder
- 抛出:
ServerErrorException
- if@InitBinder
method invocation fails
initDataBinder
protected WebExchangeDataBinder initDataBinder(WebExchangeDataBinder binder, ServerWebExchange exchange)
Initialize the data binder instance for the given exchange.- 抛出:
ServerErrorException
- if@InitBinder
method invocation fails
createDataBinder
public WebExchangeDataBinder createDataBinder(ServerWebExchange exchange, String name)
Create aWebExchangeDataBinder
without a target object for type conversion of request values to simple types.- 参数:
exchange
- the current exchangename
- the name of the target object- 返回:
- the created data binder
- 抛出:
ServerErrorException
- if@InitBinder
method invocation fails