Make getters and setters null-safety consistent

This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
This commit is contained in:
Sebastien Deleuze
2017-07-19 08:55:05 +02:00
parent ff85726fa9
commit fb4ddb0746
201 changed files with 579 additions and 489 deletions

View File

@@ -558,7 +558,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the (new) value of the {@code Access-Control-Allow-Origin} response header.
*/
public void setAccessControlAllowOrigin(String allowedOrigin) {
public void setAccessControlAllowOrigin(@Nullable String allowedOrigin) {
set(ACCESS_CONTROL_ALLOW_ORIGIN, allowedOrigin);
}
@@ -617,8 +617,8 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the (new) value of the {@code Access-Control-Request-Method} request header.
*/
public void setAccessControlRequestMethod(HttpMethod requestMethod) {
set(ACCESS_CONTROL_REQUEST_METHOD, requestMethod.name());
public void setAccessControlRequestMethod(@Nullable HttpMethod requestMethod) {
set(ACCESS_CONTROL_REQUEST_METHOD, (requestMethod != null ? requestMethod.name() : null));
}
/**
@@ -708,7 +708,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the (new) value of the {@code Cache-Control} header.
*/
public void setCacheControl(String cacheControl) {
public void setCacheControl(@Nullable String cacheControl) {
set(CACHE_CONTROL, cacheControl);
}
@@ -814,9 +814,8 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
* to set multiple content languages.</p>
* @since 5.0
*/
public void setContentLanguage(Locale locale) {
Assert.notNull(locale, "'locale' must not be null");
set(CONTENT_LANGUAGE, locale.toLanguageTag());
public void setContentLanguage(@Nullable Locale locale) {
set(CONTENT_LANGUAGE, (locale != null ? locale.toLanguageTag() : null));
}
/**
@@ -858,10 +857,15 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
* Set the {@linkplain MediaType media type} of the body,
* as specified by the {@code Content-Type} header.
*/
public void setContentType(MediaType mediaType) {
Assert.isTrue(!mediaType.isWildcardType(), "'Content-Type' cannot contain wildcard type '*'");
Assert.isTrue(!mediaType.isWildcardSubtype(), "'Content-Type' cannot contain wildcard subtype '*'");
set(CONTENT_TYPE, mediaType.toString());
public void setContentType(@Nullable MediaType mediaType) {
if (mediaType != null) {
Assert.isTrue(!mediaType.isWildcardType(), "'Content-Type' cannot contain wildcard type '*'");
Assert.isTrue(!mediaType.isWildcardSubtype(), "'Content-Type' cannot contain wildcard subtype '*'");
set(CONTENT_TYPE, mediaType.toString());
}
else {
set(CONTENT_TYPE, null);
}
}
/**
@@ -899,10 +903,12 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the (new) entity tag of the body, as specified by the {@code ETag} header.
*/
public void setETag(String etag) {
Assert.isTrue(etag.startsWith("\"") || etag.startsWith("W/"),
"Invalid ETag: does not start with W/ or \"");
Assert.isTrue(etag.endsWith("\""), "Invalid ETag: does not end with \"");
public void setETag(@Nullable String etag) {
if (etag != null) {
Assert.isTrue(etag.startsWith("\"") || etag.startsWith("W/"),
"Invalid ETag: does not start with W/ or \"");
Assert.isTrue(etag.endsWith("\""), "Invalid ETag: does not end with \"");
}
set(ETAG, etag);
}
@@ -942,10 +948,15 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
* {@linkplain InetSocketAddress#getHostString() hostname}.
* @since 5.0
*/
public void setHost(InetSocketAddress host) {
String value = (host.getPort() != 0 ?
String.format("%s:%d", host.getHostString(), host.getPort()) : host.getHostString());
set(HOST, value);
public void setHost(@Nullable InetSocketAddress host) {
if (host != null) {
String value = (host.getPort() != 0 ?
String.format("%s:%d", host.getHostString(), host.getPort()) : host.getHostString());
set(HOST, value);
}
else {
set(HOST, null);
}
}
/**
@@ -1089,8 +1100,8 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
* Set the (new) location of a resource,
* as specified by the {@code Location} header.
*/
public void setLocation(URI location) {
set(LOCATION, location.toASCIIString());
public void setLocation(@Nullable URI location) {
set(LOCATION, (location != null ? location.toASCIIString() : null));
}
/**
@@ -1107,7 +1118,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the (new) value of the {@code Origin} header.
*/
public void setOrigin(String origin) {
public void setOrigin(@Nullable String origin) {
set(ORIGIN, origin);
}
@@ -1122,7 +1133,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the (new) value of the {@code Pragma} header.
*/
public void setPragma(String pragma) {
public void setPragma(@Nullable String pragma) {
set(PRAGMA, pragma);
}
@@ -1154,7 +1165,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Set the (new) value of the {@code Upgrade} header.
*/
public void setUpgrade(String upgrade) {
public void setUpgrade(@Nullable String upgrade) {
set(UPGRADE, upgrade);
}
@@ -1431,7 +1442,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
* @see #add(String, String)
*/
@Override
public void set(String headerName, String headerValue) {
public void set(String headerName, @Nullable String headerValue) {
List<String> headerValues = new LinkedList<>();
headerValues.add(headerValue);
this.headers.put(headerName, headerValues);

View File

@@ -144,7 +144,7 @@ abstract class AbstractCodecConfigurer implements CodecConfigurer {
/**
* Access to custom codecs for sub-classes, e.g. for multipart writers.
*/
public void setCustomCodecs(DefaultCustomCodecs customCodecs) {
public void setCustomCodecs(@Nullable DefaultCustomCodecs customCodecs) {
this.customCodecs = customCodecs;
}

View File

@@ -110,7 +110,7 @@ public abstract class AbstractHttpMessageConverter<T> implements HttpMessageConv
* Set the default character set, if any.
* @since 4.3
*/
public void setDefaultCharset(Charset defaultCharset) {
public void setDefaultCharset(@Nullable Charset defaultCharset) {
this.defaultCharset = defaultCharset;
}

View File

@@ -99,12 +99,13 @@ public class BufferedImageHttpMessageConverter implements HttpMessageConverter<B
* Sets the default {@code Content-Type} to be used for writing.
* @throws IllegalArgumentException if the given content type is not supported by the Java Image I/O API
*/
public void setDefaultContentType(MediaType defaultContentType) {
Assert.notNull(defaultContentType, "'contentType' must not be null");
Iterator<ImageWriter> imageWriters = ImageIO.getImageWritersByMIMEType(defaultContentType.toString());
if (!imageWriters.hasNext()) {
throw new IllegalArgumentException(
"Content-Type [" + defaultContentType + "] is not supported by the Java Image I/O API");
public void setDefaultContentType(@Nullable MediaType defaultContentType) {
if (defaultContentType!= null) {
Iterator<ImageWriter> imageWriters = ImageIO.getImageWritersByMIMEType(defaultContentType.toString());
if (!imageWriters.hasNext()) {
throw new IllegalArgumentException(
"Content-Type [" + defaultContentType + "] is not supported by the Java Image I/O API");
}
}
this.defaultContentType = defaultContentType;

View File

@@ -61,7 +61,7 @@ public class MappingJacksonInputMessage implements HttpInputMessage {
return this.headers;
}
public void setDeserializationView(Class<?> deserializationView) {
public void setDeserializationView(@Nullable Class<?> deserializationView) {
this.deserializationView = deserializationView;
}

View File

@@ -39,10 +39,13 @@ public class MappingJacksonValue {
private Object value;
@Nullable
private Class<?> serializationView;
@Nullable
private FilterProvider filters;
@Nullable
private String jsonpFunction;
@@ -74,7 +77,7 @@ public class MappingJacksonValue {
* @see com.fasterxml.jackson.databind.ObjectMapper#writerWithView(Class)
* @see com.fasterxml.jackson.annotation.JsonView
*/
public void setSerializationView(Class<?> serializationView) {
public void setSerializationView(@Nullable Class<?> serializationView) {
this.serializationView = serializationView;
}
@@ -95,7 +98,7 @@ public class MappingJacksonValue {
* @see com.fasterxml.jackson.annotation.JsonFilter
* @see Jackson2ObjectMapperBuilder#filters(FilterProvider)
*/
public void setFilters(FilterProvider filters) {
public void setFilters(@Nullable FilterProvider filters) {
this.filters = filters;
}
@@ -113,7 +116,7 @@ public class MappingJacksonValue {
/**
* Set the name of the JSONP function name.
*/
public void setJsonpFunction(String functionName) {
public void setJsonpFunction(@Nullable String functionName) {
this.jsonpFunction = functionName;
}

View File

@@ -39,6 +39,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
/**
* Base class for {@link ServerHttpResponse} implementations.
@@ -91,11 +92,10 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
}
@Override
public boolean setStatusCode(HttpStatus statusCode) {
Assert.notNull(statusCode, "Status code must not be null");
public boolean setStatusCode(@Nullable HttpStatus statusCode) {
if (this.state.get() == State.COMMITTED) {
if (logger.isDebugEnabled()) {
logger.debug("Can't set the status " + statusCode.toString() +
logger.debug("Can't set the status " + (statusCode != null ? statusCode.toString() : "null") +
" because the HTTP response has already been committed");
}
return false;

View File

@@ -39,7 +39,7 @@ public interface ServerHttpResponse extends ReactiveHttpOutputMessage {
* @return {@code false} if the status code has not been set because the HTTP response
* is already committed, {@code true} if it has been set correctly.
*/
boolean setStatusCode(HttpStatus status);
boolean setStatusCode(@Nullable HttpStatus status);
/**
* Return the HTTP status code or {@code null} if not set.

View File

@@ -26,6 +26,7 @@ import org.springframework.core.io.buffer.DataBufferFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseCookie;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
@@ -55,7 +56,7 @@ public class ServerHttpResponseDecorator implements ServerHttpResponse {
// ServerHttpResponse delegation methods...
@Override
public boolean setStatusCode(HttpStatus status) {
public boolean setStatusCode(@Nullable HttpStatus status) {
return getDelegate().setStatusCode(status);
}

View File

@@ -92,7 +92,7 @@ public class HttpInvokerClientInterceptor extends RemoteInvocationBasedAccessor
* @see org.springframework.remoting.rmi.CodebaseAwareObjectInputStream
* @see java.rmi.server.RMIClassLoader
*/
public void setCodebaseUrl(String codebaseUrl) {
public void setCodebaseUrl(@Nullable String codebaseUrl) {
this.codebaseUrl = codebaseUrl;
}

View File

@@ -119,7 +119,7 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
* @see #setServiceName
* @see org.springframework.jndi.JndiObjectFactoryBean
*/
public void setJaxWsService(Service jaxWsService) {
public void setJaxWsService(@Nullable Service jaxWsService) {
this.jaxWsService = jaxWsService;
}
@@ -135,7 +135,7 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
* Set the name of the port.
* Corresponds to the "wsdl:port" name.
*/
public void setPortName(String portName) {
public void setPortName(@Nullable String portName) {
this.portName = portName;
}
@@ -151,7 +151,7 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
* Set the username to specify on the stub.
* @see javax.xml.ws.BindingProvider#USERNAME_PROPERTY
*/
public void setUsername(String username) {
public void setUsername(@Nullable String username) {
this.username = username;
}
@@ -167,7 +167,7 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
* Set the password to specify on the stub.
* @see javax.xml.ws.BindingProvider#PASSWORD_PROPERTY
*/
public void setPassword(String password) {
public void setPassword(@Nullable String password) {
this.password = password;
}
@@ -183,7 +183,7 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
* Set the endpoint address to specify on the stub.
* @see javax.xml.ws.BindingProvider#ENDPOINT_ADDRESS_PROPERTY
*/
public void setEndpointAddress(String endpointAddress) {
public void setEndpointAddress(@Nullable String endpointAddress) {
this.endpointAddress = endpointAddress;
}
@@ -229,7 +229,7 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
* Set the SOAP action URI to specify on the stub.
* @see javax.xml.ws.BindingProvider#SOAPACTION_URI_PROPERTY
*/
public void setSoapActionUri(String soapActionUri) {
public void setSoapActionUri(@Nullable String soapActionUri) {
this.soapActionUri = soapActionUri;
}
@@ -289,9 +289,10 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
/**
* Set the interface of the service that this factory should create a proxy for.
*/
public void setServiceInterface(Class<?> serviceInterface) {
Assert.notNull(serviceInterface, "'serviceInterface' must not be null");
Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface");
public void setServiceInterface(@Nullable Class<?> serviceInterface) {
if (serviceInterface != null) {
Assert.isTrue(serviceInterface.isInterface(), "'serviceInterface' must be an interface");
}
this.serviceInterface = serviceInterface;
}
@@ -318,7 +319,7 @@ public class JaxWsPortClientInterceptor extends LocalJaxWsServiceFactory
* building a client proxy in the {@link JaxWsPortProxyFactoryBean} subclass.
*/
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
public void setBeanClassLoader(@Nullable ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}

View File

@@ -67,7 +67,7 @@ public class LocalJaxWsServiceFactory {
* Set the URL of the WSDL document that describes the service.
* @see #setWsdlDocumentResource(Resource)
*/
public void setWsdlDocumentUrl(URL wsdlDocumentUrl) {
public void setWsdlDocumentUrl(@Nullable URL wsdlDocumentUrl) {
this.wsdlDocumentUrl = wsdlDocumentUrl;
}
@@ -109,7 +109,7 @@ public class LocalJaxWsServiceFactory {
* Set the name of the service to look up.
* Corresponds to the "wsdl:service" name.
*/
public void setServiceName(String serviceName) {
public void setServiceName(@Nullable String serviceName) {
this.serviceName = serviceName;
}

View File

@@ -131,7 +131,6 @@ public class WebDataBinder extends DataBinder {
/**
* Return the prefix for parameters that mark potentially empty fields.
*/
@Nullable
public String getFieldMarkerPrefix() {
return this.fieldMarkerPrefix;
}
@@ -157,7 +156,6 @@ public class WebDataBinder extends DataBinder {
/**
* Return the prefix for parameters that mark default fields.
*/
@Nullable
public String getFieldDefaultPrefix() {
return this.fieldDefaultPrefix;
}

View File

@@ -106,7 +106,7 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
* the data binder.
* @see org.springframework.validation.DataBinder#setMessageCodesResolver
*/
public final void setMessageCodesResolver(MessageCodesResolver messageCodesResolver) {
public final void setMessageCodesResolver(@Nullable MessageCodesResolver messageCodesResolver) {
this.messageCodesResolver = messageCodesResolver;
}
@@ -125,7 +125,7 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
* of the data binder.
* @see org.springframework.validation.DataBinder#setBindingErrorProcessor
*/
public final void setBindingErrorProcessor(BindingErrorProcessor bindingErrorProcessor) {
public final void setBindingErrorProcessor(@Nullable BindingErrorProcessor bindingErrorProcessor) {
this.bindingErrorProcessor = bindingErrorProcessor;
}
@@ -140,7 +140,7 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
/**
* Set the Validator to apply after each binding step.
*/
public final void setValidator(Validator validator) {
public final void setValidator(@Nullable Validator validator) {
this.validator = validator;
}
@@ -156,7 +156,7 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
* Specify a ConversionService which will apply to every DataBinder.
* @since 3.0
*/
public final void setConversionService(ConversionService conversionService) {
public final void setConversionService(@Nullable ConversionService conversionService) {
this.conversionService = conversionService;
}
@@ -178,7 +178,7 @@ public class ConfigurableWebBindingInitializer implements WebBindingInitializer
/**
* Specify multiple PropertyEditorRegistrars to be applied to every DataBinder.
*/
public final void setPropertyEditorRegistrars(PropertyEditorRegistrar[] propertyEditorRegistrars) {
public final void setPropertyEditorRegistrars(@Nullable PropertyEditorRegistrar[] propertyEditorRegistrars) {
this.propertyEditorRegistrars = propertyEditorRegistrars;
}

View File

@@ -58,14 +58,14 @@ public interface ConfigurableWebApplicationContext extends WebApplicationContext
* called after the setting of all configuration properties.
* @see #refresh()
*/
void setServletContext(ServletContext servletContext);
void setServletContext(@Nullable ServletContext servletContext);
/**
* Set the ServletConfig for this web application context.
* Only called for a WebApplicationContext that belongs to a specific Servlet.
* @see #refresh()
*/
void setServletConfig(ServletConfig servletConfig);
void setServletConfig(@Nullable ServletConfig servletConfig);
/**
* Return the ServletConfig for this web application context, if any.
@@ -78,7 +78,7 @@ public interface ConfigurableWebApplicationContext extends WebApplicationContext
* to be used for building a default context config location.
* The root web application context does not have a namespace.
*/
void setNamespace(String namespace);
void setNamespace(@Nullable String namespace);
/**
* Return the namespace for this web application context, if any.

View File

@@ -104,7 +104,7 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
@Override
public void setServletContext(ServletContext servletContext) {
public void setServletContext(@Nullable ServletContext servletContext) {
this.servletContext = servletContext;
}
@@ -115,7 +115,7 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
}
@Override
public void setServletConfig(ServletConfig servletConfig) {
public void setServletConfig(@Nullable ServletConfig servletConfig) {
this.servletConfig = servletConfig;
if (this.servletContext == null) {
setServletContext(servletConfig.getServletContext());
@@ -129,9 +129,9 @@ public abstract class AbstractRefreshableWebApplicationContext extends AbstractR
}
@Override
public void setNamespace(String namespace) {
public void setNamespace(@Nullable String namespace) {
this.namespace = namespace;
setDisplayName("WebApplicationContext for namespace '" + namespace + "'");
setDisplayName(namespace != null ? "WebApplicationContext for namespace '" + namespace + "'" : null);
}
@Override

View File

@@ -84,8 +84,10 @@ import org.springframework.web.context.ContextLoader;
public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWebApplicationContext
implements AnnotationConfigRegistry {
@Nullable
private BeanNameGenerator beanNameGenerator;
@Nullable
private ScopeMetadataResolver scopeMetadataResolver;
private final Set<Class<?>> annotatedClasses = new LinkedHashSet<>();
@@ -100,7 +102,7 @@ public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWe
* @see AnnotatedBeanDefinitionReader#setBeanNameGenerator
* @see ClassPathBeanDefinitionScanner#setBeanNameGenerator
*/
public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) {
public void setBeanNameGenerator(@Nullable BeanNameGenerator beanNameGenerator) {
this.beanNameGenerator = beanNameGenerator;
}
@@ -120,7 +122,7 @@ public class AnnotationConfigWebApplicationContext extends AbstractRefreshableWe
* @see AnnotatedBeanDefinitionReader#setScopeMetadataResolver
* @see ClassPathBeanDefinitionScanner#setScopeMetadataResolver
*/
public void setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver) {
public void setScopeMetadataResolver(@Nullable ScopeMetadataResolver scopeMetadataResolver) {
this.scopeMetadataResolver = scopeMetadataResolver;
}

View File

@@ -208,7 +208,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext
// ---------------------------------------------------------------------
@Override
public void setServletConfig(ServletConfig servletConfig) {
public void setServletConfig(@Nullable ServletConfig servletConfig) {
// no-op
}
@@ -219,7 +219,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext
}
@Override
public void setNamespace(String namespace) {
public void setNamespace(@Nullable String namespace) {
// no-op
}

View File

@@ -80,7 +80,7 @@ public class StaticWebApplicationContext extends StaticApplicationContext
* Set the ServletContext that this WebApplicationContext runs in.
*/
@Override
public void setServletContext(ServletContext servletContext) {
public void setServletContext(@Nullable ServletContext servletContext) {
this.servletContext = servletContext;
}
@@ -91,7 +91,7 @@ public class StaticWebApplicationContext extends StaticApplicationContext
}
@Override
public void setServletConfig(ServletConfig servletConfig) {
public void setServletConfig(@Nullable ServletConfig servletConfig) {
this.servletConfig = servletConfig;
if (this.servletContext == null) {
this.servletContext = servletConfig.getServletContext();
@@ -105,9 +105,9 @@ public class StaticWebApplicationContext extends StaticApplicationContext
}
@Override
public void setNamespace(String namespace) {
public void setNamespace(@Nullable String namespace) {
this.namespace = namespace;
setDisplayName("WebApplicationContext for namespace '" + namespace + "'");
setDisplayName(namespace != null ? "WebApplicationContext for namespace '" + namespace + "'" : null);
}
@Override

View File

@@ -278,7 +278,7 @@ public class CorsConfiguration {
* Whether user credentials are supported.
* <p>By default this is not set (i.e. user credentials are not supported).
*/
public void setAllowCredentials(Boolean allowCredentials) {
public void setAllowCredentials(@Nullable Boolean allowCredentials) {
this.allowCredentials = allowCredentials;
}
@@ -296,7 +296,7 @@ public class CorsConfiguration {
* can be cached by clients.
* <p>By default this is not set.
*/
public void setMaxAge(Long maxAge) {
public void setMaxAge(@Nullable Long maxAge) {
this.maxAge = maxAge;
}

View File

@@ -45,6 +45,7 @@ import org.springframework.util.Assert;
*/
public class CharacterEncodingFilter extends OncePerRequestFilter {
@Nullable
private String encoding;
private boolean forceRequestEncoding = false;
@@ -110,7 +111,7 @@ public class CharacterEncodingFilter extends OncePerRequestFilter {
* (and whether it will be applied as default response encoding as well)
* depends on the {@link #setForceEncoding "forceEncoding"} flag.
*/
public void setEncoding(String encoding) {
public void setEncoding(@Nullable String encoding) {
this.encoding = encoding;
}

View File

@@ -174,7 +174,7 @@ public class DelegatingFilterProxy extends GenericFilterBean {
* Set the name of the ServletContext attribute which should be used to retrieve the
* {@link WebApplicationContext} from which to load the delegate {@link Filter} bean.
*/
public void setContextAttribute(String contextAttribute) {
public void setContextAttribute(@Nullable String contextAttribute) {
this.contextAttribute = contextAttribute;
}
@@ -193,7 +193,7 @@ public class DelegatingFilterProxy extends GenericFilterBean {
* <p>By default, the {@code filter-name} as specified for the
* DelegatingFilterProxy in {@code web.xml} will be used.
*/
public void setTargetBeanName(String targetBeanName) {
public void setTargetBeanName(@Nullable String targetBeanName) {
this.targetBeanName = targetBeanName;
}

View File

@@ -39,6 +39,7 @@ import org.springframework.lang.Nullable;
*/
public abstract class DecoratingNavigationHandler extends NavigationHandler {
@Nullable
private NavigationHandler decoratedNavigationHandler;

View File

@@ -70,7 +70,7 @@ public class AcceptHeaderLocaleContextResolver implements LocaleContextResolver
* have an "Accept-Language" header (not set by default).
* @param defaultLocale the default locale to use
*/
public void setDefaultLocale(Locale defaultLocale) {
public void setDefaultLocale(@Nullable Locale defaultLocale) {
this.defaultLocale = defaultLocale;
}

View File

@@ -50,12 +50,15 @@ public class CookieGenerator {
protected final Log logger = LogFactory.getLog(getClass());
@Nullable
private String cookieName;
@Nullable
private String cookieDomain;
private String cookiePath = DEFAULT_COOKIE_PATH;
@Nullable
private Integer cookieMaxAge;
private boolean cookieSecure = false;
@@ -67,13 +70,14 @@ public class CookieGenerator {
* Use the given name for cookies created by this generator.
* @see javax.servlet.http.Cookie#getName()
*/
public void setCookieName(String cookieName) {
public void setCookieName(@Nullable String cookieName) {
this.cookieName = cookieName;
}
/**
* Return the given name for cookies created by this generator.
*/
@Nullable
public String getCookieName() {
return this.cookieName;
}
@@ -83,7 +87,7 @@ public class CookieGenerator {
* The cookie is only visible to servers in this domain.
* @see javax.servlet.http.Cookie#setDomain
*/
public void setCookieDomain(String cookieDomain) {
public void setCookieDomain(@Nullable String cookieDomain) {
this.cookieDomain = cookieDomain;
}
@@ -118,7 +122,7 @@ public class CookieGenerator {
* default.
* @see javax.servlet.http.Cookie#setMaxAge
*/
public void setCookieMaxAge(Integer cookieMaxAge) {
public void setCookieMaxAge(@Nullable Integer cookieMaxAge) {
this.cookieMaxAge = cookieMaxAge;
}