类 RelaxedDataBinder
- java.lang.Object
- org.springframework.validation.DataBinder
- org.springframework.boot.bind.RelaxedDataBinder
- 所有已实现的接口:
org.springframework.beans.PropertyEditorRegistry
,org.springframework.beans.TypeConverter
public class RelaxedDataBinder extends org.springframework.validation.DataBinder
Binder implementation that allows caller to bind to maps and also allows property names to match a bit loosely (if underscores or dashes are removed and replaced with camel case for example).- 另请参阅:
RelaxedNames
构造器概要
构造器 构造器 说明 RelaxedDataBinder(Object target)
Create a newRelaxedDataBinder
instance.RelaxedDataBinder(Object target, String namePrefix)
Create a newRelaxedDataBinder
instance.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected org.springframework.validation.AbstractPropertyBindingResult
createBeanPropertyBindingResult()
protected void
doBind(org.springframework.beans.MutablePropertyValues propertyValues)
protected String
normalizePath(org.springframework.beans.BeanWrapper wrapper, String path)
Normalize a bean property path to a format understood by a BeanWrapper.void
setIgnoreNestedProperties(boolean ignoreNestedProperties)
Flag to disable binding of nested properties (i.e. those with period separators in their paths).void
setNameAliases(Map<String,List<String>> aliases)
Set name aliases.RelaxedDataBinder
withAlias(String name, String... alias)
Add aliases to theDataBinder
.从类继承的方法 org.springframework.validation.DataBinder
addCustomFormatter, addCustomFormatter, addCustomFormatter, addValidators, applyPropertyValues, bind, checkAllowedFields, checkRequiredFields, close, convertIfNecessary, convertIfNecessary, convertIfNecessary, createDirectFieldBindingResult, findCustomEditor, getAllowedFields, getAutoGrowCollectionLimit, getBindingErrorProcessor, getBindingResult, getConversionService, getDisallowedFields, getInternalBindingResult, getObjectName, getPropertyAccessor, getPropertyEditorRegistry, getRequiredFields, getSimpleTypeConverter, getTarget, getTypeConverter, getValidator, getValidators, initBeanPropertyAccess, initDirectFieldAccess, isAllowed, isAutoGrowNestedPaths, isIgnoreInvalidFields, isIgnoreUnknownFields, registerCustomEditor, registerCustomEditor, replaceValidators, setAllowedFields, setAutoGrowCollectionLimit, setAutoGrowNestedPaths, setBindingErrorProcessor, setConversionService, setDisallowedFields, setExtractOldValueForEditor, setIgnoreInvalidFields, setIgnoreUnknownFields, setMessageCodesResolver, setRequiredFields, setValidator, validate, validate
构造器详细资料
RelaxedDataBinder
public RelaxedDataBinder(Object target)
Create a newRelaxedDataBinder
instance.- 参数:
target
- the target into which properties are bound
RelaxedDataBinder
public RelaxedDataBinder(Object target, String namePrefix)
Create a newRelaxedDataBinder
instance.- 参数:
target
- the target into which properties are boundnamePrefix
- An optional prefix to be used when reading properties
方法详细资料
setIgnoreNestedProperties
public void setIgnoreNestedProperties(boolean ignoreNestedProperties)
Flag to disable binding of nested properties (i.e. those with period separators in their paths). Can be useful to disable this if the name prefix is empty and you don't want to ignore unknown fields.- 参数:
ignoreNestedProperties
- the flag to set (default false)
setNameAliases
public void setNameAliases(Map<String,List<String>> aliases)
Set name aliases.- 参数:
aliases
- a map of property name to aliases
withAlias
public RelaxedDataBinder withAlias(String name, String... alias)
Add aliases to theDataBinder
.- 参数:
name
- the property name to aliasalias
- aliases for the property names- 返回:
- this instance
doBind
protected void doBind(org.springframework.beans.MutablePropertyValues propertyValues)
- 覆盖:
doBind
在类中org.springframework.validation.DataBinder
normalizePath
protected String normalizePath(org.springframework.beans.BeanWrapper wrapper, String path)
Normalize a bean property path to a format understood by a BeanWrapper. This is used so that- Fuzzy matching can be employed for bean property names
- Period separators can be used instead of indexing ([...]) for map keys
- 参数:
wrapper
- a bean wrapper for the object to bindpath
- the bean path to bind- 返回:
- a transformed path with correct bean wrapper syntax
createBeanPropertyBindingResult
protected org.springframework.validation.AbstractPropertyBindingResult createBeanPropertyBindingResult()
- 覆盖:
createBeanPropertyBindingResult
在类中org.springframework.validation.DataBinder