Nullability fine-tuning around bean properties
Issue: SPR-15720 Issue: SPR-15792
This commit is contained in:
@@ -54,6 +54,7 @@ public abstract class AbstractHttpMessageConverter<T> implements HttpMessageConv
|
||||
|
||||
private List<MediaType> supportedMediaTypes = Collections.emptyList();
|
||||
|
||||
@Nullable
|
||||
private Charset defaultCharset;
|
||||
|
||||
|
||||
|
||||
@@ -75,8 +75,10 @@ public class WebDataBinder extends DataBinder {
|
||||
*/
|
||||
public static final String DEFAULT_FIELD_DEFAULT_PREFIX = "!";
|
||||
|
||||
@Nullable
|
||||
private String fieldMarkerPrefix = DEFAULT_FIELD_MARKER_PREFIX;
|
||||
|
||||
@Nullable
|
||||
private String fieldDefaultPrefix = DEFAULT_FIELD_DEFAULT_PREFIX;
|
||||
|
||||
private boolean bindEmptyMultipartFiles = true;
|
||||
@@ -124,13 +126,14 @@ public class WebDataBinder extends DataBinder {
|
||||
* detect an empty field and automatically reset its value.
|
||||
* @see #DEFAULT_FIELD_MARKER_PREFIX
|
||||
*/
|
||||
public void setFieldMarkerPrefix(String fieldMarkerPrefix) {
|
||||
public void setFieldMarkerPrefix(@Nullable String fieldMarkerPrefix) {
|
||||
this.fieldMarkerPrefix = fieldMarkerPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the prefix for parameters that mark potentially empty fields.
|
||||
*/
|
||||
@Nullable
|
||||
public String getFieldMarkerPrefix() {
|
||||
return this.fieldMarkerPrefix;
|
||||
}
|
||||
@@ -149,13 +152,14 @@ public class WebDataBinder extends DataBinder {
|
||||
* marker for the given field.
|
||||
* @see #DEFAULT_FIELD_DEFAULT_PREFIX
|
||||
*/
|
||||
public void setFieldDefaultPrefix(String fieldDefaultPrefix) {
|
||||
public void setFieldDefaultPrefix(@Nullable String fieldDefaultPrefix) {
|
||||
this.fieldDefaultPrefix = fieldDefaultPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the prefix for parameters that mark default fields.
|
||||
*/
|
||||
@Nullable
|
||||
public String getFieldDefaultPrefix() {
|
||||
return this.fieldDefaultPrefix;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
|
||||
@Override
|
||||
public void setServletConfig(@Nullable ServletConfig servletConfig) {
|
||||
this.servletConfig = servletConfig;
|
||||
if (this.servletContext == null) {
|
||||
if (servletConfig != null && this.servletContext == null) {
|
||||
setServletContext(servletConfig.getServletContext());
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,9 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
|
||||
@Override
|
||||
public void setNamespace(@Nullable String namespace) {
|
||||
this.namespace = namespace;
|
||||
setDisplayName(namespace != null ? "WebApplicationContext for namespace '" + namespace + "'" : null);
|
||||
if (namespace != null) {
|
||||
setDisplayName("WebApplicationContext for namespace '" + namespace + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -93,7 +93,7 @@ public class StaticWebApplicationContext extends StaticApplicationContext
|
||||
@Override
|
||||
public void setServletConfig(@Nullable ServletConfig servletConfig) {
|
||||
this.servletConfig = servletConfig;
|
||||
if (this.servletContext == null) {
|
||||
if (servletConfig != null && this.servletContext == null) {
|
||||
this.servletContext = servletConfig.getServletContext();
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,9 @@ public class StaticWebApplicationContext extends StaticApplicationContext
|
||||
@Override
|
||||
public void setNamespace(@Nullable String namespace) {
|
||||
this.namespace = namespace;
|
||||
setDisplayName(namespace != null ? "WebApplicationContext for namespace '" + namespace + "'" : null);
|
||||
if (namespace != null) {
|
||||
setDisplayName("WebApplicationContext for namespace '" + namespace + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user