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).
Modifiers | Name | Description |
---|---|---|
private static class |
RelaxedDataBinder.BeanPath |
A path though properties of a bean. |
static class |
RelaxedDataBinder.MapHolder |
Holder to allow Map targets to be bound. |
Modifiers | Name | Description |
---|---|---|
private static java.lang.Object |
BLANK |
|
private boolean |
ignoreNestedProperties |
|
private org.springframework.util.MultiValueMap<java.lang.String, java.lang.String> |
nameAliases |
|
private java.lang.String |
namePrefix |
Fields inherited from class | Fields |
---|---|
class org.springframework.validation.DataBinder |
DEFAULT_OBJECT_NAME, DEFAULT_AUTO_GROW_COLLECTION_LIMIT |
Constructor and description |
---|
RelaxedDataBinder
(java.lang.Object target) Create a new RelaxedDataBinder instance. |
Type Params | Return Type | Name and description |
---|---|---|
|
private org.springframework.beans.MutablePropertyValues |
addMapPrefix(org.springframework.beans.MutablePropertyValues propertyValues) |
|
protected void |
doBind(org.springframework.beans.MutablePropertyValues propertyValues) |
|
private void |
extendCollectionIfNecessary(org.springframework.beans.BeanWrapper wrapper, RelaxedDataBinder.BeanPath path, int index) |
|
private void |
extendMapIfNecessary(org.springframework.beans.BeanWrapper wrapper, RelaxedDataBinder.BeanPath path, int index) |
|
private java.lang.String |
getActualPropertyName(org.springframework.beans.BeanWrapper target, java.lang.String prefix, java.lang.String name) |
|
private java.lang.Iterable<java.lang.String> |
getNameAndAliases(java.lang.String name) |
|
private org.springframework.beans.MutablePropertyValues |
getPropertyValuesForNamePrefix(org.springframework.beans.MutablePropertyValues propertyValues) |
|
private java.util.List<java.lang.String> |
getSortedPropertyNames(org.springframework.beans.MutablePropertyValues propertyValues) |
|
private java.lang.String |
initializePath(org.springframework.beans.BeanWrapper wrapper, RelaxedDataBinder.BeanPath path, int index) |
|
private boolean |
isBlanked(org.springframework.beans.BeanWrapper wrapper, java.lang.String propertyName, java.lang.String key) |
|
private boolean |
isMapValueStringType(org.springframework.core.convert.TypeDescriptor descriptor) |
|
private java.lang.String |
joinString(java.lang.String prefix, java.lang.String name) |
|
private org.springframework.beans.MutablePropertyValues |
modifyProperties(org.springframework.beans.MutablePropertyValues propertyValues, java.lang.Object target) Modify the property values so that period separated property paths are valid for map keys. |
|
private org.springframework.beans.PropertyValue |
modifyProperty(org.springframework.beans.BeanWrapper target, org.springframework.beans.PropertyValue propertyValue) |
|
private java.lang.String |
normalizePath(org.springframework.beans.BeanWrapper wrapper, java.lang.String path) Normalize a bean property path to a format understood by a BeanWrapper. |
|
private java.lang.String |
resolveNestedPropertyName(org.springframework.beans.BeanWrapper target, java.lang.String prefix, java.lang.String name) |
|
private java.lang.String |
resolvePropertyName(org.springframework.beans.BeanWrapper target, java.lang.String prefix, java.lang.String name) |
|
private void |
sortPropertyNames(java.util.List<java.lang.String> names) Sort by name so that parent properties get processed first (e.g. |
|
private java.lang.String |
stripLastDot(java.lang.String string) |
|
public RelaxedDataBinder |
withAlias(java.lang.String name, java.lang.String alias) Add aliases to the org.springframework.validation.DataBinder. |
|
private static java.lang.Object |
wrapTarget(java.lang.Object target) |
Methods inherited from class | Name |
---|---|
class org.springframework.validation.DataBinder |
org.springframework.validation.DataBinder#getValidator(), org.springframework.validation.DataBinder#getObjectName(), org.springframework.validation.DataBinder#bind(org.springframework.beans.PropertyValues), org.springframework.validation.DataBinder#getConversionService(), org.springframework.validation.DataBinder#setConversionService(org.springframework.core.convert.ConversionService), org.springframework.validation.DataBinder#getValidators(), org.springframework.validation.DataBinder#findCustomEditor(java.lang.Class, java.lang.String), org.springframework.validation.DataBinder#registerCustomEditor(java.lang.Class, java.lang.String, java.beans.PropertyEditor), org.springframework.validation.DataBinder#registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), org.springframework.validation.DataBinder#convertIfNecessary(java.lang.Object, java.lang.Class, org.springframework.core.MethodParameter), org.springframework.validation.DataBinder#convertIfNecessary(java.lang.Object, java.lang.Class), org.springframework.validation.DataBinder#convertIfNecessary(java.lang.Object, java.lang.Class, java.lang.reflect.Field), org.springframework.validation.DataBinder#convertIfNecessary(java.lang.Object, java.lang.Class, org.springframework.core.convert.TypeDescriptor), org.springframework.validation.DataBinder#setAutoGrowCollectionLimit(int), org.springframework.validation.DataBinder#getAutoGrowCollectionLimit(), org.springframework.validation.DataBinder#setAutoGrowNestedPaths(boolean), org.springframework.validation.DataBinder#isAutoGrowNestedPaths(), org.springframework.validation.DataBinder#initBeanPropertyAccess(), org.springframework.validation.DataBinder#initDirectFieldAccess(), org.springframework.validation.DataBinder#getBindingResult(), org.springframework.validation.DataBinder#setIgnoreUnknownFields(boolean), org.springframework.validation.DataBinder#isIgnoreUnknownFields(), org.springframework.validation.DataBinder#setIgnoreInvalidFields(boolean), org.springframework.validation.DataBinder#isIgnoreInvalidFields(), org.springframework.validation.DataBinder#setAllowedFields([Ljava.lang.String;), org.springframework.validation.DataBinder#getAllowedFields(), org.springframework.validation.DataBinder#setDisallowedFields([Ljava.lang.String;), org.springframework.validation.DataBinder#getDisallowedFields(), org.springframework.validation.DataBinder#setRequiredFields([Ljava.lang.String;), org.springframework.validation.DataBinder#getRequiredFields(), org.springframework.validation.DataBinder#setMessageCodesResolver(org.springframework.validation.MessageCodesResolver), org.springframework.validation.DataBinder#setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor), org.springframework.validation.DataBinder#getBindingErrorProcessor(), org.springframework.validation.DataBinder#setValidator(org.springframework.validation.Validator), org.springframework.validation.DataBinder#addValidators([Lorg.springframework.validation.Validator;), org.springframework.validation.DataBinder#replaceValidators([Lorg.springframework.validation.Validator;), org.springframework.validation.DataBinder#addCustomFormatter(org.springframework.format.Formatter), org.springframework.validation.DataBinder#addCustomFormatter(org.springframework.format.Formatter, [Ljava.lang.Class;), org.springframework.validation.DataBinder#addCustomFormatter(org.springframework.format.Formatter, [Ljava.lang.String;), org.springframework.validation.DataBinder#validate(), org.springframework.validation.DataBinder#validate([Ljava.lang.Object;), org.springframework.validation.DataBinder#close(), org.springframework.validation.DataBinder#getTarget(), org.springframework.validation.DataBinder#wait(long), org.springframework.validation.DataBinder#wait(long, int), org.springframework.validation.DataBinder#wait(), org.springframework.validation.DataBinder#equals(java.lang.Object), org.springframework.validation.DataBinder#toString(), org.springframework.validation.DataBinder#hashCode(), org.springframework.validation.DataBinder#getClass(), org.springframework.validation.DataBinder#notify(), org.springframework.validation.DataBinder#notifyAll() |
Create a new RelaxedDataBinder instance.
target
- the target into which properties are boundModify the property values so that period separated property paths are valid for map keys. Also creates new maps for properties of map type that are null (assuming all maps are potentially nested). The standard bracket {@code[...]} dereferencing is also accepted.
propertyValues
- the property valuestarget
- the target objectNormalize a bean property path to a format understood by a BeanWrapper. This is used so that
wrapper
- a bean wrapper for the object to bindpath
- the bean path to bindSort by name so that parent properties get processed first (e.g. 'foo.bar' before 'foo.bar.spam'). Don't use Collections.sort() because the order might be significant for other property names (it shouldn't be but who knows what people might be relying on, e.g. HSQL has a JDBCXADataSource where "databaseName" is a synonym for "url").
names
- the names to sortAdd aliases to the org.springframework.validation.DataBinder.
name
- the property name to aliasalias
- aliases for the property names