|
|
|
@ -230,13 +230,13 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
@@ -230,13 +230,13 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Set the type for the target object. When the target is {@code null}, |
|
|
|
|
* setting the targetType allows using {@link #construct} to |
|
|
|
|
* create the target. |
|
|
|
|
* setting the targetType allows using {@link #construct} to create the target. |
|
|
|
|
* @param targetType the type of the target object |
|
|
|
|
* @since 6.1 |
|
|
|
|
* @see #construct |
|
|
|
|
*/ |
|
|
|
|
public void setTargetType(ResolvableType targetType) { |
|
|
|
|
Assert.state(this.target == null, "targetType is used to for target creation, but target is already set"); |
|
|
|
|
Assert.state(this.target == null, "targetType is used to for target creation but target is already set"); |
|
|
|
|
this.targetType = targetType; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -458,8 +458,8 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
@@ -458,8 +458,8 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
|
|
|
|
* <p>Note that this setting only applies to <i>binding</i> operations |
|
|
|
|
* on this DataBinder, not to <i>retrieving</i> values via its |
|
|
|
|
* {@link #getBindingResult() BindingResult}. |
|
|
|
|
* <p>Used for binding to fields with {@link #bind(PropertyValues)}, and not |
|
|
|
|
* applicable to constructor binding via {@link #construct}, |
|
|
|
|
* <p>Used for binding to fields with {@link #bind(PropertyValues)}, |
|
|
|
|
* and not applicable to constructor binding via {@link #construct} |
|
|
|
|
* which uses only the values it needs. |
|
|
|
|
* @see #bind |
|
|
|
|
*/ |
|
|
|
@ -895,7 +895,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
@@ -895,7 +895,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
|
|
|
|
* @throws BeanInstantiationException in case of constructor failure |
|
|
|
|
* @since 6.1 |
|
|
|
|
*/ |
|
|
|
|
public final void construct(ValueResolver valueResolver) { |
|
|
|
|
public void construct(ValueResolver valueResolver) { |
|
|
|
|
Assert.state(this.target == null, "Target instance already available"); |
|
|
|
|
Assert.state(this.targetType != null, "Target type not set"); |
|
|
|
|
|
|
|
|
@ -1259,22 +1259,21 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
@@ -1259,22 +1259,21 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Strategy to determine the name of the value to bind to a method parameter. |
|
|
|
|
* Supported on constructor parameters with {@link #construct constructor |
|
|
|
|
* binding} which performs lookups via {@link ValueResolver#resolveValue}. |
|
|
|
|
* Supported on constructor parameters with {@link #construct constructor binding} |
|
|
|
|
* which performs lookups via {@link ValueResolver#resolveValue}. |
|
|
|
|
*/ |
|
|
|
|
public interface NameResolver { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Return the name to use for the given method parameter, or {@code null} |
|
|
|
|
* if unresolved. For constructor parameters, the name is determined via |
|
|
|
|
* {@link org.springframework.core.DefaultParameterNameDiscoverer} if |
|
|
|
|
* unresolved. |
|
|
|
|
* {@link org.springframework.core.DefaultParameterNameDiscoverer} if unresolved. |
|
|
|
|
*/ |
|
|
|
|
@Nullable |
|
|
|
|
String resolveName(MethodParameter parameter); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Strategy for {@link #construct constructor binding} to look up the values |
|
|
|
|
* to bind to a given constructor parameter. |
|
|
|
@ -1291,7 +1290,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
@@ -1291,7 +1290,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
|
|
|
|
*/ |
|
|
|
|
@Nullable |
|
|
|
|
Object resolveValue(String name, Class<?> type); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|