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

@ -34,7 +34,7 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv
private final AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut(); private final AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
public void setExpression(String expression) { public void setExpression(@Nullable String expression) {
this.pointcut.setExpression(expression); this.pointcut.setExpression(expression);
} }
@ -43,7 +43,7 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv
return this.pointcut.getExpression(); return this.pointcut.getExpression();
} }
public void setLocation(String location) { public void setLocation(@Nullable String location) {
this.pointcut.setLocation(location); this.pointcut.setLocation(location);
} }

View File

@ -203,7 +203,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
} }
@Override @Override
public void setBeanFactory(BeanFactory beanFactory) { public void setBeanFactory(@Nullable BeanFactory beanFactory) {
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }

View File

@ -70,7 +70,7 @@ public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCrea
* references. Default value is the bean name of this object + a dot. * references. Default value is the bean name of this object + a dot.
* @param advisorBeanNamePrefix the exclusion prefix * @param advisorBeanNamePrefix the exclusion prefix
*/ */
public void setAdvisorBeanNamePrefix(String advisorBeanNamePrefix) { public void setAdvisorBeanNamePrefix(@Nullable String advisorBeanNamePrefix) {
this.advisorBeanNamePrefix = advisorBeanNamePrefix; this.advisorBeanNamePrefix = advisorBeanNamePrefix;
} }

View File

@ -63,7 +63,7 @@ public abstract class AbstractBeanFactoryPointcutAdvisor extends AbstractPointcu
* of the advisor. * of the advisor.
* @see #getAdvice() * @see #getAdvice()
*/ */
public void setAdviceBeanName(String adviceBeanName) { public void setAdviceBeanName(@Nullable String adviceBeanName) {
this.adviceBeanName = adviceBeanName; this.adviceBeanName = adviceBeanName;
} }

View File

@ -43,7 +43,7 @@ public abstract class AbstractExpressionPointcut implements ExpressionPointcut,
/** /**
* Set the location for debugging. * Set the location for debugging.
*/ */
public void setLocation(String location) { public void setLocation(@Nullable String location) {
this.location = location; this.location = location;
} }
@ -58,7 +58,7 @@ public abstract class AbstractExpressionPointcut implements ExpressionPointcut,
return this.location; return this.location;
} }
public void setExpression(String expression) { public void setExpression(@Nullable String expression) {
this.expression = expression; this.expression = expression;
try { try {
onSetExpression(expression); onSetExpression(expression);
@ -82,7 +82,7 @@ public abstract class AbstractExpressionPointcut implements ExpressionPointcut,
* @throws IllegalArgumentException if the expression is invalid * @throws IllegalArgumentException if the expression is invalid
* @see #setExpression * @see #setExpression
*/ */
protected void onSetExpression(String expression) throws IllegalArgumentException { protected void onSetExpression(@Nullable String expression) throws IllegalArgumentException {
} }
/** /**

View File

@ -292,7 +292,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setReadMethod(Method readMethod) { public void setReadMethod(@Nullable Method readMethod) {
this.readMethod = readMethod; this.readMethod = readMethod;
} }
@ -303,7 +303,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setWriteMethod(Method writeMethod) { public void setWriteMethod(@Nullable Method writeMethod) {
this.writeMethod = writeMethod; this.writeMethod = writeMethod;
} }
@ -327,7 +327,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setPropertyEditorClass(Class<?> propertyEditorClass) { public void setPropertyEditorClass(@Nullable Class<?> propertyEditorClass) {
this.propertyEditorClass = propertyEditorClass; this.propertyEditorClass = propertyEditorClass;
} }
@ -399,7 +399,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setReadMethod(Method readMethod) { public void setReadMethod(@Nullable Method readMethod) {
this.readMethod = readMethod; this.readMethod = readMethod;
} }
@ -410,7 +410,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setWriteMethod(Method writeMethod) { public void setWriteMethod(@Nullable Method writeMethod) {
this.writeMethod = writeMethod; this.writeMethod = writeMethod;
} }
@ -434,7 +434,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setIndexedReadMethod(Method indexedReadMethod) throws IntrospectionException { public void setIndexedReadMethod(@Nullable Method indexedReadMethod) throws IntrospectionException {
this.indexedReadMethod = indexedReadMethod; this.indexedReadMethod = indexedReadMethod;
} }
@ -445,7 +445,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setIndexedWriteMethod(Method indexedWriteMethod) throws IntrospectionException { public void setIndexedWriteMethod(@Nullable Method indexedWriteMethod) throws IntrospectionException {
this.indexedWriteMethod = indexedWriteMethod; this.indexedWriteMethod = indexedWriteMethod;
} }
@ -470,7 +470,7 @@ class ExtendedBeanInfo implements BeanInfo {
} }
@Override @Override
public void setPropertyEditorClass(Class<?> propertyEditorClass) { public void setPropertyEditorClass(@Nullable Class<?> propertyEditorClass) {
this.propertyEditorClass = propertyEditorClass; this.propertyEditorClass = propertyEditorClass;
} }

View File

@ -101,7 +101,7 @@ public abstract class AbstractFactoryBean<T>
} }
@Override @Override
public void setBeanFactory(BeanFactory beanFactory) { public void setBeanFactory(@Nullable BeanFactory beanFactory) {
this.beanFactory = beanFactory; this.beanFactory = beanFactory;
} }

View File

@ -148,7 +148,7 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
* Set the names of the beans that this bean depends on being initialized. * Set the names of the beans that this bean depends on being initialized.
* The bean factory will guarantee that these beans get initialized first. * The bean factory will guarantee that these beans get initialized first.
*/ */
void setDependsOn(String... dependsOn); void setDependsOn(@Nullable String... dependsOn);
/** /**
* Return the bean names that this bean depends on. * Return the bean names that this bean depends on.

View File

@ -554,8 +554,8 @@ public class ConstructorArgumentValues {
* Set the converted value of the constructor argument, * Set the converted value of the constructor argument,
* after processed type conversion. * after processed type conversion.
*/ */
public synchronized void setConvertedValue(Object value) { public synchronized void setConvertedValue(@Nullable Object value) {
this.converted = true; this.converted = (value != null);
this.convertedValue = value; this.convertedValue = value;
} }

View File

@ -87,7 +87,7 @@ public class FieldRetrievingFactoryBean
* @see #setTargetObject * @see #setTargetObject
* @see #setTargetField * @see #setTargetField
*/ */
public void setTargetClass(Class<?> targetClass) { public void setTargetClass(@Nullable Class<?> targetClass) {
this.targetClass = targetClass; this.targetClass = targetClass;
} }
@ -106,7 +106,7 @@ public class FieldRetrievingFactoryBean
* @see #setTargetClass * @see #setTargetClass
* @see #setTargetField * @see #setTargetField
*/ */
public void setTargetObject(Object targetObject) { public void setTargetObject(@Nullable Object targetObject) {
this.targetObject = targetObject; this.targetObject = targetObject;
} }
@ -125,7 +125,7 @@ public class FieldRetrievingFactoryBean
* @see #setTargetClass * @see #setTargetClass
* @see #setTargetObject * @see #setTargetObject
*/ */
public void setTargetField(String targetField) { public void setTargetField(@Nullable String targetField) {
this.targetField = StringUtils.trimAllWhitespace(targetField); this.targetField = StringUtils.trimAllWhitespace(targetField);
} }

View File

@ -126,8 +126,7 @@ public class TypedStringValue implements BeanMetadataElement {
/** /**
* Specify the type to convert to. * Specify the type to convert to.
*/ */
public void setTargetTypeName(String targetTypeName) { public void setTargetTypeName(@Nullable String targetTypeName) {
Assert.notNull(targetTypeName, "'targetTypeName' must not be null");
this.targetType = targetTypeName; this.targetType = targetTypeName;
} }

View File

@ -45,7 +45,7 @@ public abstract class AbstractServiceLoaderBasedFactoryBean extends AbstractFact
/** /**
* Specify the desired service type (typically the service's public API). * Specify the desired service type (typically the service's public API).
*/ */
public void setServiceType(Class<?> serviceType) { public void setServiceType(@Nullable Class<?> serviceType) {
this.serviceType = serviceType; this.serviceType = serviceType;
} }

View File

@ -122,7 +122,7 @@ public abstract class AbstractBeanDefinitionReader implements EnvironmentCapable
* @see org.springframework.core.io.support.ResourcePatternResolver * @see org.springframework.core.io.support.ResourcePatternResolver
* @see org.springframework.core.io.support.PathMatchingResourcePatternResolver * @see org.springframework.core.io.support.PathMatchingResourcePatternResolver
*/ */
public void setResourceLoader(ResourceLoader resourceLoader) { public void setResourceLoader(@Nullable ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader; this.resourceLoader = resourceLoader;
} }

View File

@ -268,7 +268,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
* @see org.springframework.core.OrderComparator * @see org.springframework.core.OrderComparator
* @see org.springframework.core.annotation.AnnotationAwareOrderComparator * @see org.springframework.core.annotation.AnnotationAwareOrderComparator
*/ */
public void setDependencyComparator(Comparator<Object> dependencyComparator) { public void setDependencyComparator(@Nullable Comparator<Object> dependencyComparator) {
this.dependencyComparator = dependencyComparator; this.dependencyComparator = dependencyComparator;
} }

View File

@ -71,7 +71,7 @@ public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable,
/** /**
* Set the default key type name (class name) to be used for this map. * Set the default key type name (class name) to be used for this map.
*/ */
public void setKeyTypeName(String keyTypeName) { public void setKeyTypeName(@Nullable String keyTypeName) {
this.keyTypeName = keyTypeName; this.keyTypeName = keyTypeName;
} }
@ -86,7 +86,7 @@ public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable,
/** /**
* Set the default value type name (class name) to be used for this map. * Set the default value type name (class name) to be used for this map.
*/ */
public void setValueTypeName(String valueTypeName) { public void setValueTypeName(@Nullable String valueTypeName) {
this.valueTypeName = valueTypeName; this.valueTypeName = valueTypeName;
} }

View File

@ -68,7 +68,7 @@ public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMe
/** /**
* Set the default element type name (class name) to be used for this set. * Set the default element type name (class name) to be used for this set.
*/ */
public void setElementTypeName(String elementTypeName) { public void setElementTypeName(@Nullable String elementTypeName) {
this.elementTypeName = elementTypeName; this.elementTypeName = elementTypeName;
} }

View File

@ -257,7 +257,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
/** /**
* Register a target definition that is being decorated by this bean definition. * Register a target definition that is being decorated by this bean definition.
*/ */
public void setDecoratedDefinition(BeanDefinitionHolder decoratedDefinition) { public void setDecoratedDefinition(@Nullable BeanDefinitionHolder decoratedDefinition) {
this.decoratedDefinition = decoratedDefinition; this.decoratedDefinition = decoratedDefinition;
} }
@ -276,7 +276,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
* @see #setTargetType(ResolvableType) * @see #setTargetType(ResolvableType)
* @see #getResolvedFactoryMethod() * @see #getResolvedFactoryMethod()
*/ */
public void setQualifiedElement(AnnotatedElement qualifiedElement) { public void setQualifiedElement(@Nullable AnnotatedElement qualifiedElement) {
this.qualifiedElement = qualifiedElement; this.qualifiedElement = qualifiedElement;
} }

View File

@ -55,9 +55,9 @@ public class ArgumentConvertingMethodInvoker extends MethodInvoker {
* @see org.springframework.beans.SimpleTypeConverter * @see org.springframework.beans.SimpleTypeConverter
* @see org.springframework.beans.BeanWrapperImpl * @see org.springframework.beans.BeanWrapperImpl
*/ */
public void setTypeConverter(TypeConverter typeConverter) { public void setTypeConverter(@Nullable TypeConverter typeConverter) {
this.typeConverter = typeConverter; this.typeConverter = typeConverter;
this.useDefaultConverter = false; this.useDefaultConverter = (typeConverter == null);
} }
/** /**

View File

@ -37,6 +37,7 @@ import org.springframework.util.Assert;
*/ */
public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManager { public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManager {
@Nullable
private net.sf.ehcache.CacheManager cacheManager; private net.sf.ehcache.CacheManager cacheManager;
@ -59,7 +60,7 @@ public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManag
/** /**
* Set the backing EhCache {@link net.sf.ehcache.CacheManager}. * Set the backing EhCache {@link net.sf.ehcache.CacheManager}.
*/ */
public void setCacheManager(net.sf.ehcache.CacheManager cacheManager) { public void setCacheManager(@Nullable net.sf.ehcache.CacheManager cacheManager) {
this.cacheManager = cacheManager; this.cacheManager = cacheManager;
} }

View File

@ -38,6 +38,7 @@ import org.springframework.util.Assert;
*/ */
public class JCacheCacheManager extends AbstractTransactionSupportingCacheManager { public class JCacheCacheManager extends AbstractTransactionSupportingCacheManager {
@Nullable
private javax.cache.CacheManager cacheManager; private javax.cache.CacheManager cacheManager;
private boolean allowNullValues = true; private boolean allowNullValues = true;
@ -62,7 +63,7 @@ public class JCacheCacheManager extends AbstractTransactionSupportingCacheManage
/** /**
* Set the backing JCache {@link javax.cache.CacheManager}. * Set the backing JCache {@link javax.cache.CacheManager}.
*/ */
public void setCacheManager(javax.cache.CacheManager cacheManager) { public void setCacheManager(@Nullable javax.cache.CacheManager cacheManager) {
this.cacheManager = cacheManager; this.cacheManager = cacheManager;
} }

View File

@ -63,7 +63,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
* Set the default {@link CacheManager} to use to lookup cache by name. Only mandatory * Set the default {@link CacheManager} to use to lookup cache by name. Only mandatory
* if the {@linkplain CacheResolver cache resolvers} have not been set. * if the {@linkplain CacheResolver cache resolvers} have not been set.
*/ */
public void setCacheManager(CacheManager cacheManager) { public void setCacheManager(@Nullable CacheManager cacheManager) {
this.cacheManager = cacheManager; this.cacheManager = cacheManager;
} }
@ -79,7 +79,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
* Set the {@link CacheResolver} to resolve regular caches. If none is set, a default * Set the {@link CacheResolver} to resolve regular caches. If none is set, a default
* implementation using the specified cache manager will be used. * implementation using the specified cache manager will be used.
*/ */
public void setCacheResolver(CacheResolver cacheResolver) { public void setCacheResolver(@Nullable CacheResolver cacheResolver) {
this.cacheResolver = cacheResolver; this.cacheResolver = cacheResolver;
} }
@ -95,7 +95,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
* Set the {@link CacheResolver} to resolve exception caches. If none is set, a default * Set the {@link CacheResolver} to resolve exception caches. If none is set, a default
* implementation using the specified cache manager will be used. * implementation using the specified cache manager will be used.
*/ */
public void setExceptionCacheResolver(CacheResolver exceptionCacheResolver) { public void setExceptionCacheResolver(@Nullable CacheResolver exceptionCacheResolver) {
this.exceptionCacheResolver = exceptionCacheResolver; this.exceptionCacheResolver = exceptionCacheResolver;
} }
@ -112,7 +112,7 @@ public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSourc
* honoring the JSR-107 {@link javax.cache.annotation.CacheKey} and * honoring the JSR-107 {@link javax.cache.annotation.CacheKey} and
* {@link javax.cache.annotation.CacheValue} will be used. * {@link javax.cache.annotation.CacheValue} will be used.
*/ */
public void setKeyGenerator(KeyGenerator keyGenerator) { public void setKeyGenerator(@Nullable KeyGenerator keyGenerator) {
this.keyGenerator = keyGenerator; this.keyGenerator = keyGenerator;
} }

View File

@ -98,7 +98,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
@Override @Override
public void setFrom(String from) { public void setFrom(@Nullable String from) {
this.from = from; this.from = from;
} }
@ -108,7 +108,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
} }
@Override @Override
public void setReplyTo(String replyTo) { public void setReplyTo(@Nullable String replyTo) {
this.replyTo = replyTo; this.replyTo = replyTo;
} }
@ -118,12 +118,12 @@ public class SimpleMailMessage implements MailMessage, Serializable {
} }
@Override @Override
public void setTo(String to) { public void setTo(@Nullable String to) {
this.to = new String[] {to}; this.to = new String[] {to};
} }
@Override @Override
public void setTo(String[] to) { public void setTo(@Nullable String[] to) {
this.to = to; this.to = to;
} }
@ -133,12 +133,12 @@ public class SimpleMailMessage implements MailMessage, Serializable {
} }
@Override @Override
public void setCc(String cc) { public void setCc(@Nullable String cc) {
this.cc = new String[] {cc}; this.cc = new String[] {cc};
} }
@Override @Override
public void setCc(String[] cc) { public void setCc(@Nullable String[] cc) {
this.cc = cc; this.cc = cc;
} }
@ -148,12 +148,12 @@ public class SimpleMailMessage implements MailMessage, Serializable {
} }
@Override @Override
public void setBcc(String bcc) { public void setBcc(@Nullable String bcc) {
this.bcc = new String[] {bcc}; this.bcc = new String[] {bcc};
} }
@Override @Override
public void setBcc(String[] bcc) { public void setBcc(@Nullable String[] bcc) {
this.bcc = bcc; this.bcc = bcc;
} }
@ -163,7 +163,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
} }
@Override @Override
public void setSentDate(Date sentDate) { public void setSentDate(@Nullable Date sentDate) {
this.sentDate = sentDate; this.sentDate = sentDate;
} }
@ -173,7 +173,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
} }
@Override @Override
public void setSubject(String subject) { public void setSubject(@Nullable String subject) {
this.subject = subject; this.subject = subject;
} }
@ -183,7 +183,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
} }
@Override @Override
public void setText(String text) { public void setText(@Nullable String text) {
this.text = text; this.text = text;
} }

View File

@ -99,6 +99,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
@Nullable @Nullable
private String defaultEncoding; private String defaultEncoding;
@Nullable
private FileTypeMap defaultFileTypeMap; private FileTypeMap defaultFileTypeMap;
@ -165,7 +166,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
/** /**
* Set the mail protocol. Default is "smtp". * Set the mail protocol. Default is "smtp".
*/ */
public void setProtocol(String protocol) { public void setProtocol(@Nullable String protocol) {
this.protocol = protocol; this.protocol = protocol;
} }
@ -181,7 +182,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
* Set the mail server host, typically an SMTP host. * Set the mail server host, typically an SMTP host.
* <p>Default is the default host of the underlying JavaMail Session. * <p>Default is the default host of the underlying JavaMail Session.
*/ */
public void setHost(String host) { public void setHost(@Nullable String host) {
this.host = host; this.host = host;
} }
@ -220,7 +221,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
* @see #setSession * @see #setSession
* @see #setPassword * @see #setPassword
*/ */
public void setUsername(String username) { public void setUsername(@Nullable String username) {
this.username = username; this.username = username;
} }
@ -243,7 +244,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
* @see #setSession * @see #setSession
* @see #setUsername * @see #setUsername
*/ */
public void setPassword(String password) { public void setPassword(@Nullable String password) {
this.password = password; this.password = password;
} }
@ -260,7 +261,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
* created by this instance. * created by this instance.
* <p>Such an encoding will be auto-detected by {@link MimeMessageHelper}. * <p>Such an encoding will be auto-detected by {@link MimeMessageHelper}.
*/ */
public void setDefaultEncoding(String defaultEncoding) { public void setDefaultEncoding(@Nullable String defaultEncoding) {
this.defaultEncoding = defaultEncoding; this.defaultEncoding = defaultEncoding;
} }
@ -286,7 +287,7 @@ public class JavaMailSenderImpl implements JavaMailSender {
* {@code mime.types} file contained in the Spring jar). * {@code mime.types} file contained in the Spring jar).
* @see MimeMessageHelper#setFileTypeMap * @see MimeMessageHelper#setFileTypeMap
*/ */
public void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap) { public void setDefaultFileTypeMap(@Nullable FileTypeMap defaultFileTypeMap) {
this.defaultFileTypeMap = defaultFileTypeMap; this.defaultFileTypeMap = defaultFileTypeMap;
} }

View File

@ -86,12 +86,15 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
private final CacheOperationExpressionEvaluator evaluator = new CacheOperationExpressionEvaluator(); private final CacheOperationExpressionEvaluator evaluator = new CacheOperationExpressionEvaluator();
@Nullable
private CacheOperationSource cacheOperationSource; private CacheOperationSource cacheOperationSource;
private KeyGenerator keyGenerator = new SimpleKeyGenerator(); private KeyGenerator keyGenerator = new SimpleKeyGenerator();
@Nullable
private CacheResolver cacheResolver; private CacheResolver cacheResolver;
@Nullable
private BeanFactory beanFactory; private BeanFactory beanFactory;
private boolean initialized = false; private boolean initialized = false;
@ -150,8 +153,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
* @see #setCacheManager(org.springframework.cache.CacheManager) * @see #setCacheManager(org.springframework.cache.CacheManager)
* @see SimpleCacheResolver * @see SimpleCacheResolver
*/ */
public void setCacheResolver(CacheResolver cacheResolver) { public void setCacheResolver(@Nullable CacheResolver cacheResolver) {
Assert.notNull(cacheResolver, "CacheResolver must not be null");
this.cacheResolver = cacheResolver; this.cacheResolver = cacheResolver;
} }

View File

@ -90,7 +90,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
* <p>May also link to an externally defined Properties object, e.g. defined * <p>May also link to an externally defined Properties object, e.g. defined
* through a {@link org.springframework.beans.factory.config.PropertiesFactoryBean}. * through a {@link org.springframework.beans.factory.config.PropertiesFactoryBean}.
*/ */
public void setCommonMessages(Properties commonMessages) { public void setCommonMessages(@Nullable Properties commonMessages) {
this.commonMessages = commonMessages; this.commonMessages = commonMessages;
} }

View File

@ -119,7 +119,7 @@ public abstract class AbstractResourceBasedMessageSource extends AbstractMessage
* <p>Only applies to classic properties files, not to XML files. * <p>Only applies to classic properties files, not to XML files.
* @param defaultEncoding the default charset * @param defaultEncoding the default charset
*/ */
public void setDefaultEncoding(String defaultEncoding) { public void setDefaultEncoding(@Nullable String defaultEncoding) {
this.defaultEncoding = defaultEncoding; this.defaultEncoding = defaultEncoding;
} }

View File

@ -70,7 +70,7 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
* Using a business methods interface is a best practice when implementing EJBs. * Using a business methods interface is a best practice when implementing EJBs.
* @param businessInterface set the business interface of the EJB * @param businessInterface set the business interface of the EJB
*/ */
public void setBusinessInterface(Class<?> businessInterface) { public void setBusinessInterface(@Nullable Class<?> businessInterface) {
this.businessInterface = businessInterface; this.businessInterface = businessInterface;
} }

View File

@ -84,7 +84,7 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
* converted to Spring's generic RemoteAccessException. * converted to Spring's generic RemoteAccessException.
* @param businessInterface the business interface of the EJB * @param businessInterface the business interface of the EJB
*/ */
public void setBusinessInterface(Class<?> businessInterface) { public void setBusinessInterface(@Nullable Class<?> businessInterface) {
this.businessInterface = businessInterface; this.businessInterface = businessInterface;
} }

View File

@ -49,7 +49,7 @@ public class JodaTimeContext {
/** /**
* Set the user's chronology (calendar system). * Set the user's chronology (calendar system).
*/ */
public void setChronology(Chronology chronology) { public void setChronology(@Nullable Chronology chronology) {
this.chronology = chronology; this.chronology = chronology;
} }
@ -69,7 +69,7 @@ public class JodaTimeContext {
* @see org.springframework.context.i18n.LocaleContextHolder#getTimeZone() * @see org.springframework.context.i18n.LocaleContextHolder#getTimeZone()
* @see org.springframework.context.i18n.LocaleContextHolder#setLocaleContext * @see org.springframework.context.i18n.LocaleContextHolder#setLocaleContext
*/ */
public void setTimeZone(DateTimeZone timeZone) { public void setTimeZone(@Nullable DateTimeZone timeZone) {
this.timeZone = timeZone; this.timeZone = timeZone;
} }

View File

@ -47,7 +47,7 @@ public class DateTimeContext {
/** /**
* Set the user's chronology (calendar system). * Set the user's chronology (calendar system).
*/ */
public void setChronology(Chronology chronology) { public void setChronology(@Nullable Chronology chronology) {
this.chronology = chronology; this.chronology = chronology;
} }
@ -67,7 +67,7 @@ public class DateTimeContext {
* @see org.springframework.context.i18n.LocaleContextHolder#getTimeZone() * @see org.springframework.context.i18n.LocaleContextHolder#getTimeZone()
* @see org.springframework.context.i18n.LocaleContextHolder#setLocaleContext * @see org.springframework.context.i18n.LocaleContextHolder#setLocaleContext
*/ */
public void setTimeZone(ZoneId timeZone) { public void setTimeZone(@Nullable ZoneId timeZone) {
this.timeZone = timeZone; this.timeZone = timeZone;
} }

View File

@ -158,7 +158,7 @@ public class MBeanClientInterceptor
* Specify the environment for the JMX connector. * Specify the environment for the JMX connector.
* @see javax.management.remote.JMXConnectorFactory#connect(javax.management.remote.JMXServiceURL, java.util.Map) * @see javax.management.remote.JMXConnectorFactory#connect(javax.management.remote.JMXServiceURL, java.util.Map)
*/ */
public void setEnvironment(Map<String, ?> environment) { public void setEnvironment(@Nullable Map<String, ?> environment) {
this.environment = environment; this.environment = environment;
} }
@ -229,7 +229,7 @@ public class MBeanClientInterceptor
* setters and getters for MBean attributes and conventional Java methods * setters and getters for MBean attributes and conventional Java methods
* for MBean operations. * for MBean operations.
*/ */
public void setManagementInterface(Class<?> managementInterface) { public void setManagementInterface(@Nullable Class<?> managementInterface) {
this.managementInterface = managementInterface; this.managementInterface = managementInterface;
} }

View File

@ -82,7 +82,7 @@ public class NotificationListenerRegistrar extends NotificationListenerHolder
* Specify the environment for the JMX connector. * Specify the environment for the JMX connector.
* @see javax.management.remote.JMXConnectorFactory#connect(javax.management.remote.JMXServiceURL, java.util.Map) * @see javax.management.remote.JMXConnectorFactory#connect(javax.management.remote.JMXServiceURL, java.util.Map)
*/ */
public void setEnvironment(Map<String, ?> environment) { public void setEnvironment(@Nullable Map<String, ?> environment) {
this.environment = environment; this.environment = environment;
} }

View File

@ -172,6 +172,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
/** /**
* Default value for the JMX field "currencyTimeLimit". * Default value for the JMX field "currencyTimeLimit".
*/ */
@Nullable
private Integer defaultCurrencyTimeLimit; private Integer defaultCurrencyTimeLimit;
/** /**
@ -181,6 +182,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
private boolean exposeClassDescriptor = false; private boolean exposeClassDescriptor = false;
@Nullable
private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer(); private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer();
@ -204,7 +206,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
* @see org.springframework.jmx.export.metadata.AbstractJmxAttribute#setCurrencyTimeLimit * @see org.springframework.jmx.export.metadata.AbstractJmxAttribute#setCurrencyTimeLimit
* @see #applyCurrencyTimeLimit(javax.management.Descriptor, int) * @see #applyCurrencyTimeLimit(javax.management.Descriptor, int)
*/ */
public void setDefaultCurrencyTimeLimit(Integer defaultCurrencyTimeLimit) { public void setDefaultCurrencyTimeLimit(@Nullable Integer defaultCurrencyTimeLimit) {
this.defaultCurrencyTimeLimit = defaultCurrencyTimeLimit; this.defaultCurrencyTimeLimit = defaultCurrencyTimeLimit;
} }
@ -266,7 +268,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
* names if needed (e.g. for parameter names of MBean operation methods). * names if needed (e.g. for parameter names of MBean operation methods).
* <p>Default is a {@link DefaultParameterNameDiscoverer}. * <p>Default is a {@link DefaultParameterNameDiscoverer}.
*/ */
public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer) { public void setParameterNameDiscoverer(@Nullable ParameterNameDiscoverer parameterNameDiscoverer) {
this.parameterNameDiscoverer = parameterNameDiscoverer; this.parameterNameDiscoverer = parameterNameDiscoverer;
} }

View File

@ -27,10 +27,13 @@ import org.springframework.util.StringUtils;
*/ */
public class ManagedNotification { public class ManagedNotification {
@Nullable
private String[] notificationTypes; private String[] notificationTypes;
@Nullable
private String name; private String name;
@Nullable
private String description; private String description;
@ -45,7 +48,7 @@ public class ManagedNotification {
/** /**
* Set a list of notification types. * Set a list of notification types.
*/ */
public void setNotificationTypes(String... notificationTypes) { public void setNotificationTypes(@Nullable String... notificationTypes) {
this.notificationTypes = notificationTypes; this.notificationTypes = notificationTypes;
} }
@ -60,13 +63,14 @@ public class ManagedNotification {
/** /**
* Set the name of this notification. * Set the name of this notification.
*/ */
public void setName(String name) { public void setName(@Nullable String name) {
this.name = name; this.name = name;
} }
/** /**
* Return the name of this notification. * Return the name of this notification.
*/ */
@Nullable
public String getName() { public String getName() {
return this.name; return this.name;
} }
@ -74,7 +78,7 @@ public class ManagedNotification {
/** /**
* Set a description for this notification. * Set a description for this notification.
*/ */
public void setDescription(String description) { public void setDescription(@Nullable String description) {
this.description = description; this.description = description;
} }

View File

@ -96,7 +96,7 @@ public class MBeanRegistrationSupport {
* be registered. The {@code MBeanExporter} will attempt to locate an * be registered. The {@code MBeanExporter} will attempt to locate an
* existing {@code MBeanServer} if none is supplied. * existing {@code MBeanServer} if none is supplied.
*/ */
public void setServer(MBeanServer server) { public void setServer(@Nullable MBeanServer server) {
this.server = server; this.server = server;
} }

View File

@ -62,7 +62,7 @@ public abstract class JndiObjectLocator extends JndiLocatorSupport implements In
* @param jndiName the JNDI name to look up * @param jndiName the JNDI name to look up
* @see #setResourceRef * @see #setResourceRef
*/ */
public void setJndiName(String jndiName) { public void setJndiName(@Nullable String jndiName) {
this.jndiName = jndiName; this.jndiName = jndiName;
} }

View File

@ -181,7 +181,7 @@ public class RemoteInvocation implements Serializable {
* @see #addAttribute * @see #addAttribute
* @see #getAttribute * @see #getAttribute
*/ */
public void setAttributes(Map<String, Serializable> attributes) { public void setAttributes(@Nullable Map<String, Serializable> attributes) {
this.attributes = attributes; this.attributes = attributes;
} }

View File

@ -41,8 +41,10 @@ public class RemoteInvocationResult implements Serializable {
private static final long serialVersionUID = 2138555143707773549L; private static final long serialVersionUID = 2138555143707773549L;
@Nullable
private Object value; private Object value;
@Nullable
private Throwable exception; private Throwable exception;
@ -81,7 +83,7 @@ public class RemoteInvocationResult implements Serializable {
* Use {@link #RemoteInvocationResult(Object)} otherwise. * Use {@link #RemoteInvocationResult(Object)} otherwise.
* @see #RemoteInvocationResult() * @see #RemoteInvocationResult()
*/ */
public void setValue(Object value) { public void setValue(@Nullable Object value) {
this.value = value; this.value = value;
} }
@ -102,7 +104,7 @@ public class RemoteInvocationResult implements Serializable {
* Use {@link #RemoteInvocationResult(Throwable)} otherwise. * Use {@link #RemoteInvocationResult(Throwable)} otherwise.
* @see #RemoteInvocationResult() * @see #RemoteInvocationResult()
*/ */
public void setException(Throwable exception) { public void setException(@Nullable Throwable exception) {
this.exception = exception; this.exception = exception;
} }

View File

@ -92,9 +92,11 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
* {@link java.util.concurrent.ScheduledExecutorService} to be wrapped as a * {@link java.util.concurrent.ScheduledExecutorService} to be wrapped as a
* {@code TaskScheduler}. * {@code TaskScheduler}.
*/ */
public void setScheduler(Object scheduler) { public void setScheduler(@Nullable Object scheduler) {
Assert.notNull(scheduler, "Scheduler object must not be null"); if (scheduler == null) {
if (scheduler instanceof TaskScheduler) { this.taskScheduler = null;
}
else if (scheduler instanceof TaskScheduler) {
this.taskScheduler = (TaskScheduler) scheduler; this.taskScheduler = (TaskScheduler) scheduler;
} }
else if (scheduler instanceof ScheduledExecutorService) { else if (scheduler instanceof ScheduledExecutorService) {

View File

@ -424,7 +424,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* @see #setDisallowedFields * @see #setDisallowedFields
* @see #isAllowed(String) * @see #isAllowed(String)
*/ */
public void setAllowedFields(String... allowedFields) { public void setAllowedFields(@Nullable String... allowedFields) {
this.allowedFields = PropertyAccessorUtils.canonicalPropertyNames(allowedFields); this.allowedFields = PropertyAccessorUtils.canonicalPropertyNames(allowedFields);
} }
@ -448,7 +448,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* @see #setAllowedFields * @see #setAllowedFields
* @see #isAllowed(String) * @see #isAllowed(String)
*/ */
public void setDisallowedFields(String... disallowedFields) { public void setDisallowedFields(@Nullable String... disallowedFields) {
this.disallowedFields = PropertyAccessorUtils.canonicalPropertyNames(disallowedFields); this.disallowedFields = PropertyAccessorUtils.canonicalPropertyNames(disallowedFields);
} }
@ -471,7 +471,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* @see #setBindingErrorProcessor * @see #setBindingErrorProcessor
* @see DefaultBindingErrorProcessor#MISSING_FIELD_ERROR_CODE * @see DefaultBindingErrorProcessor#MISSING_FIELD_ERROR_CODE
*/ */
public void setRequiredFields(String... requiredFields) { public void setRequiredFields(@Nullable String... requiredFields) {
this.requiredFields = PropertyAccessorUtils.canonicalPropertyNames(requiredFields); this.requiredFields = PropertyAccessorUtils.canonicalPropertyNames(requiredFields);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("DataBinder requires binding of required fields [" + logger.debug("DataBinder requires binding of required fields [" +
@ -526,14 +526,18 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* @see #addValidators(Validator...) * @see #addValidators(Validator...)
* @see #replaceValidators(Validator...) * @see #replaceValidators(Validator...)
*/ */
public void setValidator(Validator validator) { public void setValidator(@Nullable Validator validator) {
assertValidators(validator); assertValidators(validator);
this.validators.clear(); this.validators.clear();
if (validator != null) {
this.validators.add(validator); this.validators.add(validator);
} }
}
private void assertValidators(Validator... validators) { private void assertValidators(Validator... validators) {
Assert.notNull(validators, "Validators required"); if (validators == null) {
return;
}
for (Validator validator : validators) { for (Validator validator : validators) {
if (validator != null && (getTarget() != null && !validator.supports(getTarget().getClass()))) { if (validator != null && (getTarget() != null && !validator.supports(getTarget().getClass()))) {
throw new IllegalStateException("Invalid target for Validator [" + validator + "]: " + getTarget()); throw new IllegalStateException("Invalid target for Validator [" + validator + "]: " + getTarget());

View File

@ -56,7 +56,7 @@ public class ConvertingPropertyEditorAdapter extends PropertyEditorSupport {
@Override @Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(@Nullable String text) throws IllegalArgumentException {
setValue(this.conversionService.convert(text, TypeDescriptor.valueOf(String.class), this.targetDescriptor)); setValue(this.conversionService.convert(text, TypeDescriptor.valueOf(String.class), this.targetDescriptor));
} }

View File

@ -103,7 +103,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement
* @see #setThreadNamePrefix * @see #setThreadNamePrefix
* @see #setThreadPriority * @see #setThreadPriority
*/ */
public void setThreadFactory(ThreadFactory threadFactory) { public void setThreadFactory(@Nullable ThreadFactory threadFactory) {
this.threadFactory = threadFactory; this.threadFactory = threadFactory;
} }

View File

@ -430,7 +430,7 @@ public abstract class CollectionUtils {
} }
@Override @Override
public void set(K key, V value) { public void set(K key, @Nullable V value) {
List<V> values = new LinkedList<>(); List<V> values = new LinkedList<>();
values.add(value); values.add(value);
this.map.put(key, values); this.map.put(key, values);

View File

@ -127,7 +127,7 @@ public class CustomizableThreadCreator implements Serializable {
* Specify the thread group that threads should be created in. * Specify the thread group that threads should be created in.
* @see #setThreadGroupName * @see #setThreadGroupName
*/ */
public void setThreadGroup(ThreadGroup threadGroup) { public void setThreadGroup(@Nullable ThreadGroup threadGroup) {
this.threadGroup = threadGroup; this.threadGroup = threadGroup;
} }

View File

@ -101,7 +101,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
} }
@Override @Override
public void set(K key, V value) { public void set(K key, @Nullable V value) {
List<V> values = new LinkedList<>(); List<V> values = new LinkedList<>();
values.add(value); values.add(value);
this.targetMap.put(key, values); this.targetMap.put(key, values);

View File

@ -65,7 +65,7 @@ public class MethodInvoker {
* @see #setTargetObject * @see #setTargetObject
* @see #setTargetMethod * @see #setTargetMethod
*/ */
public void setTargetClass(Class<?> targetClass) { public void setTargetClass(@Nullable Class<?> targetClass) {
this.targetClass = targetClass; this.targetClass = targetClass;
} }
@ -106,7 +106,7 @@ public class MethodInvoker {
* @see #setTargetClass * @see #setTargetClass
* @see #setTargetObject * @see #setTargetObject
*/ */
public void setTargetMethod(String targetMethod) { public void setTargetMethod(@Nullable String targetMethod) {
this.targetMethod = targetMethod; this.targetMethod = targetMethod;
} }

View File

@ -64,7 +64,7 @@ public interface MultiValueMap<K, V> extends Map<K, List<V>> {
* @param key the key * @param key the key
* @param value the value to set * @param value the value to set
*/ */
void set(K key, V value); void set(K key, @Nullable V value);
/** /**
* Set the given values under. * Set the given values under.

View File

@ -41,19 +41,24 @@ import org.springframework.lang.Nullable;
*/ */
abstract class AbstractXMLReader implements XMLReader { abstract class AbstractXMLReader implements XMLReader {
@Nullable
private DTDHandler dtdHandler; private DTDHandler dtdHandler;
@Nullable
private ContentHandler contentHandler; private ContentHandler contentHandler;
@Nullable
private EntityResolver entityResolver; private EntityResolver entityResolver;
@Nullable
private ErrorHandler errorHandler; private ErrorHandler errorHandler;
@Nullable
private LexicalHandler lexicalHandler; private LexicalHandler lexicalHandler;
@Override @Override
public void setContentHandler(ContentHandler contentHandler) { public void setContentHandler(@Nullable ContentHandler contentHandler) {
this.contentHandler = contentHandler; this.contentHandler = contentHandler;
} }
@ -64,7 +69,7 @@ abstract class AbstractXMLReader implements XMLReader {
} }
@Override @Override
public void setDTDHandler(DTDHandler dtdHandler) { public void setDTDHandler(@Nullable DTDHandler dtdHandler) {
this.dtdHandler = dtdHandler; this.dtdHandler = dtdHandler;
} }
@ -75,7 +80,7 @@ abstract class AbstractXMLReader implements XMLReader {
} }
@Override @Override
public void setEntityResolver(EntityResolver entityResolver) { public void setEntityResolver(@Nullable EntityResolver entityResolver) {
this.entityResolver = entityResolver; this.entityResolver = entityResolver;
} }
@ -86,7 +91,7 @@ abstract class AbstractXMLReader implements XMLReader {
} }
@Override @Override
public void setErrorHandler(ErrorHandler errorHandler) { public void setErrorHandler(@Nullable ErrorHandler errorHandler) {
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
} }

View File

@ -143,7 +143,7 @@ public class CallMetaDataContext {
/** /**
* Specify the name of the procedure. * Specify the name of the procedure.
*/ */
public void setProcedureName(String procedureName) { public void setProcedureName(@Nullable String procedureName) {
this.procedureName = procedureName; this.procedureName = procedureName;
} }
@ -158,7 +158,7 @@ public class CallMetaDataContext {
/** /**
* Specify the name of the catalog. * Specify the name of the catalog.
*/ */
public void setCatalogName(String catalogName) { public void setCatalogName(@Nullable String catalogName) {
this.catalogName = catalogName; this.catalogName = catalogName;
} }
@ -173,7 +173,7 @@ public class CallMetaDataContext {
/** /**
* Secify the name of the schema. * Secify the name of the schema.
*/ */
public void setSchemaName(String schemaName) { public void setSchemaName(@Nullable String schemaName) {
this.schemaName = schemaName; this.schemaName = schemaName;
} }

View File

@ -75,7 +75,7 @@ public class TableMetaDataContext {
/** /**
* Set the name of the table for this context. * Set the name of the table for this context.
*/ */
public void setTableName(String tableName) { public void setTableName(@Nullable String tableName) {
this.tableName = tableName; this.tableName = tableName;
} }
@ -90,7 +90,7 @@ public class TableMetaDataContext {
/** /**
* Set the name of the catalog for this context. * Set the name of the catalog for this context.
*/ */
public void setCatalogName(String catalogName) { public void setCatalogName(@Nullable String catalogName) {
this.catalogName = catalogName; this.catalogName = catalogName;
} }
@ -105,7 +105,7 @@ public class TableMetaDataContext {
/** /**
* Set the name of the schema for this context. * Set the name of the schema for this context.
*/ */
public void setSchemaName(String schemaName) { public void setSchemaName(@Nullable String schemaName) {
this.schemaName = schemaName; this.schemaName = schemaName;
} }

View File

@ -108,7 +108,7 @@ public abstract class AbstractJdbcCall {
/** /**
* Set the name of the stored procedure. * Set the name of the stored procedure.
*/ */
public void setProcedureName(String procedureName) { public void setProcedureName(@Nullable String procedureName) {
this.callMetaDataContext.setProcedureName(procedureName); this.callMetaDataContext.setProcedureName(procedureName);
} }
@ -137,7 +137,7 @@ public abstract class AbstractJdbcCall {
/** /**
* Set the catalog name to use. * Set the catalog name to use.
*/ */
public void setCatalogName(String catalogName) { public void setCatalogName(@Nullable String catalogName) {
this.callMetaDataContext.setCatalogName(catalogName); this.callMetaDataContext.setCatalogName(catalogName);
} }
@ -152,7 +152,7 @@ public abstract class AbstractJdbcCall {
/** /**
* Set the schema name to use. * Set the schema name to use.
*/ */
public void setSchemaName(String schemaName) { public void setSchemaName(@Nullable String schemaName) {
this.callMetaDataContext.setSchemaName(schemaName); this.callMetaDataContext.setSchemaName(schemaName);
} }

View File

@ -119,7 +119,7 @@ public abstract class AbstractJdbcInsert {
/** /**
* Set the name of the table for this insert. * Set the name of the table for this insert.
*/ */
public void setTableName(String tableName) { public void setTableName(@Nullable String tableName) {
checkIfConfigurationModificationIsAllowed(); checkIfConfigurationModificationIsAllowed();
this.tableMetaDataContext.setTableName(tableName); this.tableMetaDataContext.setTableName(tableName);
} }
@ -135,7 +135,7 @@ public abstract class AbstractJdbcInsert {
/** /**
* Set the name of the schema for this insert. * Set the name of the schema for this insert.
*/ */
public void setSchemaName(String schemaName) { public void setSchemaName(@Nullable String schemaName) {
checkIfConfigurationModificationIsAllowed(); checkIfConfigurationModificationIsAllowed();
this.tableMetaDataContext.setSchemaName(schemaName); this.tableMetaDataContext.setSchemaName(schemaName);
} }
@ -151,7 +151,7 @@ public abstract class AbstractJdbcInsert {
/** /**
* Set the name of the catalog for this insert. * Set the name of the catalog for this insert.
*/ */
public void setCatalogName(String catalogName) { public void setCatalogName(@Nullable String catalogName) {
checkIfConfigurationModificationIsAllowed(); checkIfConfigurationModificationIsAllowed();
this.tableMetaDataContext.setCatalogName(catalogName); this.tableMetaDataContext.setCatalogName(catalogName);
} }

View File

@ -84,7 +84,7 @@ public abstract class JdbcDaoSupport extends DaoSupport {
* Set the JdbcTemplate for this DAO explicitly, * Set the JdbcTemplate for this DAO explicitly,
* as an alternative to specifying a DataSource. * as an alternative to specifying a DataSource.
*/ */
public final void setJdbcTemplate(JdbcTemplate jdbcTemplate) { public final void setJdbcTemplate(@Nullable JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate; this.jdbcTemplate = jdbcTemplate;
initTemplateConfig(); initTemplateConfig();
} }

View File

@ -57,7 +57,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* Set the JDBC URL to use for connecting through the Driver. * Set the JDBC URL to use for connecting through the Driver.
* @see java.sql.Driver#connect(String, java.util.Properties) * @see java.sql.Driver#connect(String, java.util.Properties)
*/ */
public void setUrl(String url) { public void setUrl(@Nullable String url) {
Assert.hasText(url, "Property 'url' must not be empty"); Assert.hasText(url, "Property 'url' must not be empty");
this.url = url.trim(); this.url = url.trim();
} }
@ -74,7 +74,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* Set the JDBC username to use for connecting through the Driver. * Set the JDBC username to use for connecting through the Driver.
* @see java.sql.Driver#connect(String, java.util.Properties) * @see java.sql.Driver#connect(String, java.util.Properties)
*/ */
public void setUsername(String username) { public void setUsername(@Nullable String username) {
this.username = username; this.username = username;
} }
@ -90,7 +90,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* Set the JDBC password to use for connecting through the Driver. * Set the JDBC password to use for connecting through the Driver.
* @see java.sql.Driver#connect(String, java.util.Properties) * @see java.sql.Driver#connect(String, java.util.Properties)
*/ */
public void setPassword(String password) { public void setPassword(@Nullable String password) {
this.password = password; this.password = password;
} }
@ -107,7 +107,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* @since 4.3.2 * @since 4.3.2
* @see Connection#setCatalog * @see Connection#setCatalog
*/ */
public void setCatalog(String catalog) { public void setCatalog(@Nullable String catalog) {
this.catalog = catalog; this.catalog = catalog;
} }
@ -125,7 +125,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* @since 4.3.2 * @since 4.3.2
* @see Connection#setSchema * @see Connection#setSchema
*/ */
public void setSchema(String schema) { public void setSchema(@Nullable String schema) {
this.schema = schema; this.schema = schema;
} }
@ -146,7 +146,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* DataSource will override the corresponding connection properties. * DataSource will override the corresponding connection properties.
* @see java.sql.Driver#connect(String, java.util.Properties) * @see java.sql.Driver#connect(String, java.util.Properties)
*/ */
public void setConnectionProperties(Properties connectionProperties) { public void setConnectionProperties(@Nullable Properties connectionProperties) {
this.connectionProperties = connectionProperties; this.connectionProperties = connectionProperties;
} }

View File

@ -155,7 +155,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
* @see TransactionAwareDataSourceProxy * @see TransactionAwareDataSourceProxy
* @see org.springframework.transaction.jta.JtaTransactionManager * @see org.springframework.transaction.jta.JtaTransactionManager
*/ */
public void setDataSource(DataSource dataSource) { public void setDataSource(@Nullable DataSource dataSource) {
if (dataSource instanceof TransactionAwareDataSourceProxy) { if (dataSource instanceof TransactionAwareDataSourceProxy) {
// If we got a TransactionAwareDataSourceProxy, we need to perform transactions // If we got a TransactionAwareDataSourceProxy, we need to perform transactions
// for its underlying target DataSource, else data access code won't see // for its underlying target DataSource, else data access code won't see

View File

@ -40,6 +40,7 @@ import org.springframework.util.Assert;
*/ */
public class DelegatingDataSource implements DataSource, InitializingBean { public class DelegatingDataSource implements DataSource, InitializingBean {
@Nullable
private DataSource targetDataSource; private DataSource targetDataSource;
@ -62,8 +63,7 @@ public class DelegatingDataSource implements DataSource, InitializingBean {
/** /**
* Set the target DataSource that this DataSource should delegate to. * Set the target DataSource that this DataSource should delegate to.
*/ */
public void setTargetDataSource(DataSource targetDataSource) { public void setTargetDataSource(@Nullable DataSource targetDataSource) {
Assert.notNull(targetDataSource, "'targetDataSource' must not be null");
this.targetDataSource = targetDataSource; this.targetDataSource = targetDataSource;
} }

View File

@ -38,6 +38,7 @@ public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExcep
/** Logger available to subclasses */ /** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
@Nullable
private SQLExceptionTranslator fallbackTranslator; private SQLExceptionTranslator fallbackTranslator;
@ -45,7 +46,7 @@ public abstract class AbstractFallbackSQLExceptionTranslator implements SQLExcep
* Override the default SQL state fallback translator * Override the default SQL state fallback translator
* (typically a {@link SQLStateSQLExceptionTranslator}). * (typically a {@link SQLStateSQLExceptionTranslator}).
*/ */
public void setFallbackTranslator(SQLExceptionTranslator fallback) { public void setFallbackTranslator(@Nullable SQLExceptionTranslator fallback) {
this.fallbackTranslator = fallback; this.fallbackTranslator = fallback;
} }

View File

@ -53,8 +53,8 @@ public class CustomSQLErrorCodesTranslation {
/** /**
* Set the exception class for the specified error codes. * Set the exception class for the specified error codes.
*/ */
public void setExceptionClass(Class<?> exceptionClass) { public void setExceptionClass(@Nullable Class<?> exceptionClass) {
if (!DataAccessException.class.isAssignableFrom(exceptionClass)) { if (exceptionClass != null && !DataAccessException.class.isAssignableFrom(exceptionClass)) {
throw new IllegalArgumentException("Invalid exception class [" + exceptionClass + throw new IllegalArgumentException("Invalid exception class [" + exceptionClass +
"]: needs to be a subclass of [org.springframework.dao.DataAccessException]"); "]: needs to be a subclass of [org.springframework.dao.DataAccessException]");
} }

View File

@ -54,7 +54,7 @@ public abstract class JdbcAccessor implements InitializingBean {
/** /**
* Set the JDBC DataSource to obtain connections from. * Set the JDBC DataSource to obtain connections from.
*/ */
public void setDataSource(DataSource dataSource) { public void setDataSource(@Nullable DataSource dataSource) {
this.dataSource = dataSource; this.dataSource = dataSource;
} }

View File

@ -152,7 +152,7 @@ public class SQLErrorCodeSQLExceptionTranslator extends AbstractFallbackSQLExcep
* Set custom error codes to be used for translation. * Set custom error codes to be used for translation.
* @param sec custom error codes to use * @param sec custom error codes to use
*/ */
public void setSqlErrorCodes(SQLErrorCodes sec) { public void setSqlErrorCodes(@Nullable SQLErrorCodes sec) {
this.sqlErrorCodes = sec; this.sqlErrorCodes = sec;
} }

View File

@ -71,7 +71,7 @@ public class SQLErrorCodes {
* Set this property if the database name contains spaces, * Set this property if the database name contains spaces,
* in which case we can not use the bean name for lookup. * in which case we can not use the bean name for lookup.
*/ */
public void setDatabaseProductName(String databaseProductName) { public void setDatabaseProductName(@Nullable String databaseProductName) {
this.databaseProductNames = new String[] {databaseProductName}; this.databaseProductNames = new String[] {databaseProductName};
} }
@ -85,7 +85,7 @@ public class SQLErrorCodes {
* Set this property to specify multiple database names that contains spaces, * Set this property to specify multiple database names that contains spaces,
* in which case we can not use bean names for lookup. * in which case we can not use bean names for lookup.
*/ */
public void setDatabaseProductNames(String... databaseProductNames) { public void setDatabaseProductNames(@Nullable String... databaseProductNames) {
this.databaseProductNames = databaseProductNames; this.databaseProductNames = databaseProductNames;
} }
@ -210,7 +210,7 @@ public class SQLErrorCodes {
} }
} }
public void setCustomSqlExceptionTranslator(SQLExceptionTranslator customSqlExceptionTranslator) { public void setCustomSqlExceptionTranslator(@Nullable SQLExceptionTranslator customSqlExceptionTranslator) {
this.customSqlExceptionTranslator = customSqlExceptionTranslator; this.customSqlExceptionTranslator = customSqlExceptionTranslator;
} }

View File

@ -63,7 +63,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
/** /**
* Set the {@link JmsListenerEndpointRegistry} instance to use. * Set the {@link JmsListenerEndpointRegistry} instance to use.
*/ */
public void setEndpointRegistry(JmsListenerEndpointRegistry endpointRegistry) { public void setEndpointRegistry(@Nullable JmsListenerEndpointRegistry endpointRegistry) {
this.endpointRegistry = endpointRegistry; this.endpointRegistry = endpointRegistry;
} }
@ -84,7 +84,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
* or to customize conversion and validation support. See * or to customize conversion and validation support. See
* {@link DefaultMessageHandlerMethodFactory} javadoc for more details. * {@link DefaultMessageHandlerMethodFactory} javadoc for more details.
*/ */
public void setMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory) { public void setMessageHandlerMethodFactory(@Nullable MessageHandlerMethodFactory messageHandlerMethodFactory) {
this.messageHandlerMethodFactory = messageHandlerMethodFactory; this.messageHandlerMethodFactory = messageHandlerMethodFactory;
} }

View File

@ -68,7 +68,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
/** /**
* Set the actual bean instance to invoke this endpoint method on. * Set the actual bean instance to invoke this endpoint method on.
*/ */
public void setBean(Object bean) { public void setBean(@Nullable Object bean) {
this.bean = bean; this.bean = bean;
} }
@ -80,7 +80,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
/** /**
* Set the method to invoke for processing a message managed by this endpoint. * Set the method to invoke for processing a message managed by this endpoint.
*/ */
public void setMethod(Method method) { public void setMethod(@Nullable Method method) {
this.method = method; this.method = method;
} }
@ -95,7 +95,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
* (if annotated itself, that is, if not just annotated in an interface). * (if annotated itself, that is, if not just annotated in an interface).
* @since 4.2.3 * @since 4.2.3
*/ */
public void setMostSpecificMethod(Method mostSpecificMethod) { public void setMostSpecificMethod(@Nullable Method mostSpecificMethod) {
this.mostSpecificMethod = mostSpecificMethod; this.mostSpecificMethod = mostSpecificMethod;
} }

View File

@ -39,7 +39,7 @@ public class SimpleJmsListenerEndpoint extends AbstractJmsListenerEndpoint {
* Set the {@link MessageListener} to invoke when a message matching * Set the {@link MessageListener} to invoke when a message matching
* the endpoint is received. * the endpoint is received.
*/ */
public void setMessageListener(MessageListener messageListener) { public void setMessageListener(@Nullable MessageListener messageListener) {
this.messageListener = messageListener; this.messageListener = messageListener;
} }

View File

@ -55,6 +55,7 @@ import org.springframework.util.Assert;
public class DelegatingConnectionFactory public class DelegatingConnectionFactory
implements SmartConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, InitializingBean { implements SmartConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, InitializingBean {
@Nullable
private ConnectionFactory targetConnectionFactory; private ConnectionFactory targetConnectionFactory;
private boolean shouldStopConnections = false; private boolean shouldStopConnections = false;
@ -63,8 +64,7 @@ public class DelegatingConnectionFactory
/** /**
* Set the target ConnectionFactory that this ConnectionFactory should delegate to. * Set the target ConnectionFactory that this ConnectionFactory should delegate to.
*/ */
public void setTargetConnectionFactory(ConnectionFactory targetConnectionFactory) { public void setTargetConnectionFactory(@Nullable ConnectionFactory targetConnectionFactory) {
Assert.notNull(targetConnectionFactory, "'targetConnectionFactory' must not be null");
this.targetConnectionFactory = targetConnectionFactory; this.targetConnectionFactory = targetConnectionFactory;
} }

View File

@ -127,8 +127,8 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
/** /**
* Set the JMS ConnectionFactory that this instance should manage transactions for. * Set the JMS ConnectionFactory that this instance should manage transactions for.
*/ */
public void setConnectionFactory(ConnectionFactory cf) { public void setConnectionFactory(@Nullable ConnectionFactory cf) {
if (cf instanceof TransactionAwareConnectionFactoryProxy) { if (cf != null && cf instanceof TransactionAwareConnectionFactoryProxy) {
// If we got a TransactionAwareConnectionFactoryProxy, we need to perform transactions // If we got a TransactionAwareConnectionFactoryProxy, we need to perform transactions
// for its underlying target ConnectionFactory, else JMS access code won't see // for its underlying target ConnectionFactory, else JMS access code won't see
// properly exposed transactions (i.e. transactions for the target ConnectionFactory). // properly exposed transactions (i.e. transactions for the target ConnectionFactory).

View File

@ -143,7 +143,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
* Set the target ConnectionFactory which will be used to lazily * Set the target ConnectionFactory which will be used to lazily
* create a single Connection. * create a single Connection.
*/ */
public void setTargetConnectionFactory(ConnectionFactory targetConnectionFactory) { public void setTargetConnectionFactory(@Nullable ConnectionFactory targetConnectionFactory) {
this.targetConnectionFactory = targetConnectionFactory; this.targetConnectionFactory = targetConnectionFactory;
} }
@ -151,7 +151,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
* Return the target ConnectionFactory which will be used to lazily * Return the target ConnectionFactory which will be used to lazily
* create a single Connection, if any. * create a single Connection, if any.
*/ */
@org.springframework.lang.Nullable @Nullable
public ConnectionFactory getTargetConnectionFactory() { public ConnectionFactory getTargetConnectionFactory() {
return this.targetConnectionFactory; return this.targetConnectionFactory;
} }
@ -165,7 +165,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
* @see javax.jms.Connection#setClientID * @see javax.jms.Connection#setClientID
* @see #setTargetConnectionFactory * @see #setTargetConnectionFactory
*/ */
public void setClientId(String clientId) { public void setClientId(@Nullable String clientId) {
this.clientId = clientId; this.clientId = clientId;
} }
@ -173,7 +173,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
* Return a JMS client ID for the single Connection created and exposed * Return a JMS client ID for the single Connection created and exposed
* by this ConnectionFactory, if any. * by this ConnectionFactory, if any.
*/ */
@org.springframework.lang.Nullable @Nullable
protected String getClientId() { protected String getClientId() {
return this.clientId; return this.clientId;
} }
@ -183,7 +183,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
* registered with the single Connection created by this factory. * registered with the single Connection created by this factory.
* @see #setReconnectOnException * @see #setReconnectOnException
*/ */
public void setExceptionListener(ExceptionListener exceptionListener) { public void setExceptionListener(@Nullable ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener; this.exceptionListener = exceptionListener;
} }

View File

@ -81,6 +81,7 @@ public class TransactionAwareConnectionFactoryProxy
private boolean synchedLocalTransactionAllowed = false; private boolean synchedLocalTransactionAllowed = false;
@Nullable
private ConnectionFactory targetConnectionFactory; private ConnectionFactory targetConnectionFactory;
@ -102,8 +103,7 @@ public class TransactionAwareConnectionFactoryProxy
/** /**
* Set the target ConnectionFactory that this ConnectionFactory should delegate to. * Set the target ConnectionFactory that this ConnectionFactory should delegate to.
*/ */
public final void setTargetConnectionFactory(ConnectionFactory targetConnectionFactory) { public final void setTargetConnectionFactory(@Nullable ConnectionFactory targetConnectionFactory) {
Assert.notNull(targetConnectionFactory, "'targetConnectionFactory' must not be null");
this.targetConnectionFactory = targetConnectionFactory; this.targetConnectionFactory = targetConnectionFactory;
} }

View File

@ -106,7 +106,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
/** /**
* Set the {@link JmsTemplate} to use. * Set the {@link JmsTemplate} to use.
*/ */
public void setJmsTemplate(JmsTemplate jmsTemplate) { public void setJmsTemplate(@Nullable JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate; this.jmsTemplate = jmsTemplate;
} }
@ -147,7 +147,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
* without a destination argument will raise an exception if invoked. * without a destination argument will raise an exception if invoked.
* @see #setDefaultDestination(Object) * @see #setDefaultDestination(Object)
*/ */
public void setDefaultDestinationName(String defaultDestinationName) { public void setDefaultDestinationName(@Nullable String defaultDestinationName) {
this.defaultDestinationName = defaultDestinationName; this.defaultDestinationName = defaultDestinationName;
} }

View File

@ -92,6 +92,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
private final JmsTemplateResourceFactory transactionalResourceFactory = new JmsTemplateResourceFactory(); private final JmsTemplateResourceFactory transactionalResourceFactory = new JmsTemplateResourceFactory();
@Nullable
private Object defaultDestination; private Object defaultDestination;
private MessageConverter messageConverter; private MessageConverter messageConverter;
@ -161,7 +162,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
* @see #convertAndSend(Object, MessagePostProcessor) * @see #convertAndSend(Object, MessagePostProcessor)
* @see #setDefaultDestinationName(String) * @see #setDefaultDestinationName(String)
*/ */
public void setDefaultDestination(Destination destination) { public void setDefaultDestination(@Nullable Destination destination) {
this.defaultDestination = destination; this.defaultDestination = destination;
} }
@ -195,7 +196,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
* @see #setDestinationResolver * @see #setDestinationResolver
* @see #setDefaultDestination(javax.jms.Destination) * @see #setDefaultDestination(javax.jms.Destination)
*/ */
public void setDefaultDestinationName(String destinationName) { public void setDefaultDestinationName(@Nullable String destinationName) {
this.defaultDestination = destinationName; this.defaultDestination = destinationName;
} }
@ -234,7 +235,6 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
/** /**
* Return the message converter for this template. * Return the message converter for this template.
*/ */
@Nullable
public MessageConverter getMessageConverter() { public MessageConverter getMessageConverter() {
return this.messageConverter; return this.messageConverter;
} }

View File

@ -84,7 +84,7 @@ public abstract class JmsGatewaySupport implements InitializingBean {
* Set the JmsTemplate for the gateway. * Set the JmsTemplate for the gateway.
* @see #setConnectionFactory(javax.jms.ConnectionFactory) * @see #setConnectionFactory(javax.jms.ConnectionFactory)
*/ */
public final void setJmsTemplate(JmsTemplate jmsTemplate) { public final void setJmsTemplate(@Nullable JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate; this.jmsTemplate = jmsTemplate;
} }

View File

@ -96,7 +96,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
* @see javax.jms.Connection#setClientID * @see javax.jms.Connection#setClientID
* @see #setConnectionFactory * @see #setConnectionFactory
*/ */
public void setClientId(String clientId) { public void setClientId(@Nullable String clientId) {
this.clientId = clientId; this.clientId = clientId;
} }
@ -143,7 +143,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
} }
@Override @Override
public void setBeanName(String beanName) { public void setBeanName(@Nullable String beanName) {
this.beanName = beanName; this.beanName = beanName;
} }

View File

@ -196,8 +196,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* CACHE_CONSUMER). However, this is considered advanced usage; use it with care! * CACHE_CONSUMER). However, this is considered advanced usage; use it with care!
* @see #setDestinationName(String) * @see #setDestinationName(String)
*/ */
public void setDestination(Destination destination) { public void setDestination(@Nullable Destination destination) {
Assert.notNull(destination, "'destination' must not be null");
this.destination = destination; this.destination = destination;
if (destination instanceof Topic && !(destination instanceof Queue)) { if (destination instanceof Topic && !(destination instanceof Queue)) {
// Clearly a Topic: let's set the "pubSubDomain" flag accordingly. // Clearly a Topic: let's set the "pubSubDomain" flag accordingly.
@ -226,8 +225,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* CACHE_CONSUMER). However, this is considered advanced usage; use it with care! * CACHE_CONSUMER). However, this is considered advanced usage; use it with care!
* @see #setDestination(javax.jms.Destination) * @see #setDestination(javax.jms.Destination)
*/ */
public void setDestinationName(String destinationName) { public void setDestinationName(@Nullable String destinationName) {
Assert.notNull(destinationName, "'destinationName' must not be null");
this.destination = destinationName; this.destination = destinationName;
} }
@ -286,10 +284,10 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* @see javax.jms.MessageListener * @see javax.jms.MessageListener
* @see SessionAwareMessageListener * @see SessionAwareMessageListener
*/ */
public void setMessageListener(Object messageListener) { public void setMessageListener(@Nullable Object messageListener) {
checkMessageListener(messageListener); checkMessageListener(messageListener);
this.messageListener = messageListener; this.messageListener = messageListener;
if (this.subscriptionName == null) { if (messageListener != null && this.subscriptionName == null) {
this.subscriptionName = getDefaultSubscriptionName(messageListener); this.subscriptionName = getDefaultSubscriptionName(messageListener);
} }
} }
@ -313,8 +311,8 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* @see javax.jms.MessageListener * @see javax.jms.MessageListener
* @see SessionAwareMessageListener * @see SessionAwareMessageListener
*/ */
protected void checkMessageListener(Object messageListener) { protected void checkMessageListener(@Nullable Object messageListener) {
if (!(messageListener instanceof MessageListener || if (messageListener != null && !(messageListener instanceof MessageListener ||
messageListener instanceof SessionAwareMessageListener)) { messageListener instanceof SessionAwareMessageListener)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Message listener needs to be of type [" + MessageListener.class.getName() + "Message listener needs to be of type [" + MessageListener.class.getName() +
@ -408,7 +406,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* @see #setClientId * @see #setClientId
* @see #setMessageListener * @see #setMessageListener
*/ */
public void setSubscriptionName(String subscriptionName) { public void setSubscriptionName(@Nullable String subscriptionName) {
this.subscriptionName = subscriptionName; this.subscriptionName = subscriptionName;
} }
@ -435,9 +433,9 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* @see #setClientId * @see #setClientId
* @see #setMessageListener * @see #setMessageListener
*/ */
public void setDurableSubscriptionName(String durableSubscriptionName) { public void setDurableSubscriptionName(@Nullable String durableSubscriptionName) {
this.subscriptionName = durableSubscriptionName; this.subscriptionName = durableSubscriptionName;
this.subscriptionDurable = true; this.subscriptionDurable = (durableSubscriptionName != null);
} }
/** /**
@ -529,7 +527,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* Set the JMS ExceptionListener to notify in case of a JMSException thrown * Set the JMS ExceptionListener to notify in case of a JMSException thrown
* by the registered message listener or the invocation infrastructure. * by the registered message listener or the invocation infrastructure.
*/ */
public void setExceptionListener(ExceptionListener exceptionListener) { public void setExceptionListener(@Nullable ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener; this.exceptionListener = exceptionListener;
} }
@ -548,7 +546,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* <p>By default, there will be <b>no</b> ErrorHandler so that error-level * <p>By default, there will be <b>no</b> ErrorHandler so that error-level
* logging is the only result. * logging is the only result.
*/ */
public void setErrorHandler(ErrorHandler errorHandler) { public void setErrorHandler(@Nullable ErrorHandler errorHandler) {
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
} }

View File

@ -123,7 +123,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
* @see org.springframework.transaction.jta.JtaTransactionManager * @see org.springframework.transaction.jta.JtaTransactionManager
* @see org.springframework.jms.connection.JmsTransactionManager * @see org.springframework.jms.connection.JmsTransactionManager
*/ */
public void setTransactionManager(PlatformTransactionManager transactionManager) { public void setTransactionManager(@Nullable PlatformTransactionManager transactionManager) {
this.transactionManager = transactionManager; this.transactionManager = transactionManager;
} }

View File

@ -142,7 +142,7 @@ public abstract class AbstractAdaptableMessageListener
* {@link javax.jms.TextMessage TextMessages} and * {@link javax.jms.TextMessage TextMessages} and
* {@link javax.jms.ObjectMessage ObjectMessages}. * {@link javax.jms.ObjectMessage ObjectMessages}.
*/ */
public void setMessageConverter(MessageConverter messageConverter) { public void setMessageConverter(@Nullable MessageConverter messageConverter) {
this.messageConverter = messageConverter; this.messageConverter = messageConverter;
} }

View File

@ -78,7 +78,7 @@ public class JmsActivationSpecConfig {
private MessageConverter messageConverter; private MessageConverter messageConverter;
public void setDestinationName(String destinationName) { public void setDestinationName(@Nullable String destinationName) {
this.destinationName = destinationName; this.destinationName = destinationName;
} }
@ -108,7 +108,7 @@ public class JmsActivationSpecConfig {
} }
} }
public void setReplyQosSettings(QosSettings replyQosSettings) { public void setReplyQosSettings(@Nullable QosSettings replyQosSettings) {
this.replyQosSettings = replyQosSettings; this.replyQosSettings = replyQosSettings;
} }
@ -139,7 +139,7 @@ public class JmsActivationSpecConfig {
return this.subscriptionShared; return this.subscriptionShared;
} }
public void setSubscriptionName(String subscriptionName) { public void setSubscriptionName(@Nullable String subscriptionName) {
this.subscriptionName = subscriptionName; this.subscriptionName = subscriptionName;
} }
@ -148,9 +148,9 @@ public class JmsActivationSpecConfig {
return this.subscriptionName; return this.subscriptionName;
} }
public void setDurableSubscriptionName(String durableSubscriptionName) { public void setDurableSubscriptionName(@Nullable String durableSubscriptionName) {
this.subscriptionName = durableSubscriptionName; this.subscriptionName = durableSubscriptionName;
this.subscriptionDurable = true; this.subscriptionDurable = (durableSubscriptionName != null);
} }
@Nullable @Nullable
@ -158,7 +158,7 @@ public class JmsActivationSpecConfig {
return (this.subscriptionDurable ? this.subscriptionName : null); return (this.subscriptionDurable ? this.subscriptionName : null);
} }
public void setClientId(String clientId) { public void setClientId(@Nullable String clientId) {
this.clientId = clientId; this.clientId = clientId;
} }
@ -167,7 +167,7 @@ public class JmsActivationSpecConfig {
return this.clientId; return this.clientId;
} }
public void setMessageSelector(String messageSelector) { public void setMessageSelector(@Nullable String messageSelector) {
this.messageSelector = messageSelector; this.messageSelector = messageSelector;
} }
@ -274,7 +274,7 @@ public class JmsActivationSpecConfig {
* Set the {@link MessageConverter} strategy for converting JMS Messages. * Set the {@link MessageConverter} strategy for converting JMS Messages.
* @param messageConverter the message converter to use * @param messageConverter the message converter to use
*/ */
public void setMessageConverter(MessageConverter messageConverter) { public void setMessageConverter(@Nullable MessageConverter messageConverter) {
this.messageConverter = messageConverter; this.messageConverter = messageConverter;
} }

View File

@ -138,7 +138,7 @@ public class JmsMessageEndpointManager extends GenericMessageEndpointManager
* <p>This config object will be turned into a concrete JCA 1.5 ActivationSpec * <p>This config object will be turned into a concrete JCA 1.5 ActivationSpec
* object through a {@link #setActivationSpecFactory JmsActivationSpecFactory}. * object through a {@link #setActivationSpecFactory JmsActivationSpecFactory}.
*/ */
public void setActivationSpecConfig(JmsActivationSpecConfig activationSpecConfig) { public void setActivationSpecConfig(@Nullable JmsActivationSpecConfig activationSpecConfig) {
this.activationSpecConfig = activationSpecConfig; this.activationSpecConfig = activationSpecConfig;
} }

View File

@ -90,7 +90,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor
* or {@link org.springframework.jms.support.destination.BeanFactoryDestinationResolver} * or {@link org.springframework.jms.support.destination.BeanFactoryDestinationResolver}
* but not {@link org.springframework.jms.support.destination.DynamicDestinationResolver}. * but not {@link org.springframework.jms.support.destination.DynamicDestinationResolver}.
*/ */
public void setDestinationResolver(DestinationResolver destinationResolver) { public void setDestinationResolver(@Nullable DestinationResolver destinationResolver) {
this.destinationResolver = destinationResolver; this.destinationResolver = destinationResolver;
} }

View File

@ -92,7 +92,7 @@ public class JmsInvokerClientInterceptor implements MethodInterceptor, Initializ
/** /**
* Set the QueueConnectionFactory to use for obtaining JMS QueueConnections. * Set the QueueConnectionFactory to use for obtaining JMS QueueConnections.
*/ */
public void setConnectionFactory(ConnectionFactory connectionFactory) { public void setConnectionFactory(@Nullable ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory; this.connectionFactory = connectionFactory;
} }

View File

@ -54,6 +54,7 @@ public abstract class JmsAccessor implements InitializingBean {
/** Logger available to subclasses */ /** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass()); protected final Log logger = LogFactory.getLog(getClass());
@Nullable
private ConnectionFactory connectionFactory; private ConnectionFactory connectionFactory;
private boolean sessionTransacted = false; private boolean sessionTransacted = false;
@ -64,7 +65,7 @@ public abstract class JmsAccessor implements InitializingBean {
/** /**
* Set the ConnectionFactory to use for obtaining JMS {@link Connection Connections}. * Set the ConnectionFactory to use for obtaining JMS {@link Connection Connections}.
*/ */
public void setConnectionFactory(ConnectionFactory connectionFactory) { public void setConnectionFactory(@Nullable ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory; this.connectionFactory = connectionFactory;
} }

View File

@ -16,6 +16,7 @@
package org.springframework.jms.listener; package org.springframework.jms.listener;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/** /**
@ -29,9 +30,9 @@ public abstract class AbstractMessageListenerContainerTests {
protected abstract AbstractMessageListenerContainer getContainer(); protected abstract AbstractMessageListenerContainer getContainer();
@Test(expected = IllegalArgumentException.class) public void testSettingMessageListenerToANullType() {
public void testSettingMessageListenerToANullType() throws Exception {
getContainer().setMessageListener(null); getContainer().setMessageListener(null);
Assert.assertNull(getContainer().getMessageListener());
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)

View File

@ -92,7 +92,7 @@ public class MarshallingMessageConverter extends AbstractMessageConverter {
/** /**
* Set the {@link Marshaller} to be used by this message converter. * Set the {@link Marshaller} to be used by this message converter.
*/ */
public void setMarshaller(Marshaller marshaller) { public void setMarshaller(@Nullable Marshaller marshaller) {
this.marshaller = marshaller; this.marshaller = marshaller;
} }
@ -107,7 +107,7 @@ public class MarshallingMessageConverter extends AbstractMessageConverter {
/** /**
* Set the {@link Unmarshaller} to be used by this message converter. * Set the {@link Unmarshaller} to be used by this message converter.
*/ */
public void setUnmarshaller(Unmarshaller unmarshaller) { public void setUnmarshaller(@Nullable Unmarshaller unmarshaller) {
this.unmarshaller = unmarshaller; this.unmarshaller = unmarshaller;
} }

View File

@ -51,8 +51,7 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
* require resolving a destination name will raise an {@link IllegalArgumentException}. * require resolving a destination name will raise an {@link IllegalArgumentException}.
* @param destinationResolver the destination resolver to use * @param destinationResolver the destination resolver to use
*/ */
public void setDestinationResolver(DestinationResolver<D> destinationResolver) { public void setDestinationResolver(@Nullable DestinationResolver<D> destinationResolver) {
Assert.notNull(destinationResolver, "'destinationResolver' is required");
this.destinationResolver = destinationResolver; this.destinationResolver = destinationResolver;
} }

View File

@ -63,7 +63,7 @@ public abstract class AbstractMessageSendingTemplate<D> implements MessageSendin
* a destination argument. If a default destination is not configured, send methods * a destination argument. If a default destination is not configured, send methods
* without a destination argument will raise an exception if invoked. * without a destination argument will raise an exception if invoked.
*/ */
public void setDefaultDestination(D defaultDestination) { public void setDefaultDestination(@Nullable D defaultDestination) {
this.defaultDestination = defaultDestination; this.defaultDestination = defaultDestination;
} }

View File

@ -96,6 +96,7 @@ public abstract class AbstractMethodMessageHandler<T>
private final HandlerMethodReturnValueHandlerComposite returnValueHandlers = private final HandlerMethodReturnValueHandlerComposite returnValueHandlers =
new HandlerMethodReturnValueHandlerComposite(); new HandlerMethodReturnValueHandlerComposite();
@Nullable
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
private final Map<T, HandlerMethod> handlerMethods = new LinkedHashMap<>(64); private final Map<T, HandlerMethod> handlerMethods = new LinkedHashMap<>(64);
@ -211,7 +212,7 @@ public abstract class AbstractMethodMessageHandler<T>
} }
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) { public void setApplicationContext(@Nullable ApplicationContext applicationContext) {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
} }

View File

@ -121,8 +121,7 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor {
return (SimpMessageType) getHeader(MESSAGE_TYPE_HEADER); return (SimpMessageType) getHeader(MESSAGE_TYPE_HEADER);
} }
public void setDestination(String destination) { public void setDestination(@Nullable String destination) {
Assert.notNull(destination, "Destination must not be null");
setHeader(DESTINATION_HEADER, destination); setHeader(DESTINATION_HEADER, destination);
} }
@ -155,7 +154,7 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor {
/** /**
* A static alternative for access to the session attributes header. * A static alternative for access to the session attributes header.
*/ */
public void setSessionAttributes(Map<String, Object> attributes) { public void setSessionAttributes(@Nullable Map<String, Object> attributes) {
setHeader(SESSION_ATTRIBUTES, attributes); setHeader(SESSION_ATTRIBUTES, attributes);
} }
@ -168,7 +167,7 @@ public class SimpMessageHeaderAccessor extends NativeMessageHeaderAccessor {
return (Map<String, Object>) getHeader(SESSION_ATTRIBUTES); return (Map<String, Object>) getHeader(SESSION_ATTRIBUTES);
} }
public void setUser(Principal principal) { public void setUser(@Nullable Principal principal) {
setHeader(USER_HEADER, principal); setHeader(USER_HEADER, principal);
} }

View File

@ -111,7 +111,7 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String
* messages created through the {@code SimpMessagingTemplate}. * messages created through the {@code SimpMessagingTemplate}.
* <p>By default, this property is not set. * <p>By default, this property is not set.
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -121,7 +121,7 @@ public class SendToMethodReturnValueHandler implements HandlerMethodReturnValueH
* messages sent to the client outbound channel. * messages sent to the client outbound channel.
* <p>By default this property is not set. * <p>By default this property is not set.
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -234,7 +234,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan
* @see org.springframework.validation.annotation.Validated * @see org.springframework.validation.annotation.Validated
* @see PayloadArgumentResolver * @see PayloadArgumentResolver
*/ */
public void setValidator(Validator validator) { public void setValidator(@Nullable Validator validator) {
this.validator = validator; this.validator = validator;
} }
@ -249,7 +249,7 @@ public class SimpAnnotationMethodMessageHandler extends AbstractMethodMessageHan
* that send messages from controller return values. * that send messages from controller return values.
* <p>By default, this property is not set. * <p>By default, this property is not set.
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -63,6 +63,7 @@ public class SubscriptionMethodReturnValueHandler implements HandlerMethodReturn
private final MessageSendingOperations<String> messagingTemplate; private final MessageSendingOperations<String> messagingTemplate;
@Nullable
private MessageHeaderInitializer headerInitializer; private MessageHeaderInitializer headerInitializer;
@ -82,7 +83,7 @@ public class SubscriptionMethodReturnValueHandler implements HandlerMethodReturn
* messages sent to the client outbound channel. * messages sent to the client outbound channel.
* <p>By default this property is not set. * <p>By default this property is not set.
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -129,7 +129,7 @@ public abstract class AbstractBrokerMessageHandler
} }
@Override @Override
public void setApplicationEventPublisher(ApplicationEventPublisher publisher) { public void setApplicationEventPublisher(@Nullable ApplicationEventPublisher publisher) {
this.eventPublisher = publisher; this.eventPublisher = publisher;
} }

View File

@ -157,10 +157,9 @@ public class SimpleBrokerMessageHandler extends AbstractBrokerMessageHandler {
* <p>By default this is not set. * <p>By default this is not set.
* @since 4.2 * @since 4.2
*/ */
public void setTaskScheduler(TaskScheduler taskScheduler) { public void setTaskScheduler(@Nullable TaskScheduler taskScheduler) {
Assert.notNull(taskScheduler, "TaskScheduler must not be null");
this.taskScheduler = taskScheduler; this.taskScheduler = taskScheduler;
if (this.heartbeatValue == null) { if (taskScheduler != null && this.heartbeatValue == null) {
this.heartbeatValue = new long[] {10000, 10000}; this.heartbeatValue = new long[] {10000, 10000};
} }
} }
@ -183,8 +182,8 @@ public class SimpleBrokerMessageHandler extends AbstractBrokerMessageHandler {
* (in milliseconds). * (in milliseconds).
* @since 4.2 * @since 4.2
*/ */
public void setHeartbeatValue(long[] heartbeat) { public void setHeartbeatValue(@Nullable long[] heartbeat) {
if (heartbeat.length != 2 || heartbeat[0] < 0 || heartbeat[1] < 0) { if (heartbeat != null && (heartbeat.length != 2 || heartbeat[0] < 0 || heartbeat[1] < 0)) {
throw new IllegalArgumentException("Invalid heart-beat: " + Arrays.toString(heartbeat)); throw new IllegalArgumentException("Invalid heart-beat: " + Arrays.toString(heartbeat));
} }
this.heartbeatValue = heartbeat; this.heartbeatValue = heartbeat;
@ -205,7 +204,7 @@ public class SimpleBrokerMessageHandler extends AbstractBrokerMessageHandler {
* <p>By default this property is not set. * <p>By default this property is not set.
* @since 4.1 * @since 4.1
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -112,7 +112,7 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) { public void setApplicationContext(@Nullable ApplicationContext applicationContext) {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
} }

View File

@ -325,7 +325,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
* providing the cloud-based STOMP service. * providing the cloud-based STOMP service.
* <p>By default this property is not set. * <p>By default this property is not set.
*/ */
public void setVirtualHost(String virtualHost) { public void setVirtualHost(@Nullable String virtualHost) {
this.virtualHost = virtualHost; this.virtualHost = virtualHost;
} }
@ -341,7 +341,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
* Configure a TCP client for managing TCP connections to the STOMP broker. * Configure a TCP client for managing TCP connections to the STOMP broker.
* <p>By default {@link ReactorNettyTcpClient} is used. * <p>By default {@link ReactorNettyTcpClient} is used.
*/ */
public void setTcpClient(TcpOperations<byte[]> tcpClient) { public void setTcpClient(@Nullable TcpOperations<byte[]> tcpClient) {
this.tcpClient = tcpClient; this.tcpClient = tcpClient;
} }
@ -361,7 +361,7 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
* are sent to the client outbound message channel. * are sent to the client outbound message channel.
* <p>By default this property is not set. * <p>By default this property is not set.
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -43,6 +43,7 @@ public abstract class StompClientSupport {
private MessageConverter messageConverter = new SimpleMessageConverter(); private MessageConverter messageConverter = new SimpleMessageConverter();
@Nullable
private TaskScheduler taskScheduler; private TaskScheduler taskScheduler;
private long[] defaultHeartbeat = new long[] {10000, 10000}; private long[] defaultHeartbeat = new long[] {10000, 10000};
@ -76,7 +77,7 @@ public abstract class StompClientSupport {
* Receipts however, if needed, do require a TaskScheduler to be configured. * Receipts however, if needed, do require a TaskScheduler to be configured.
* <p>By default, this is not set. * <p>By default, this is not set.
*/ */
public void setTaskScheduler(TaskScheduler taskScheduler) { public void setTaskScheduler(@Nullable TaskScheduler taskScheduler) {
this.taskScheduler = taskScheduler; this.taskScheduler = taskScheduler;
} }

View File

@ -61,7 +61,7 @@ public class StompDecoder {
* Configure a {@link MessageHeaderInitializer} to apply to the headers of * Configure a {@link MessageHeaderInitializer} to apply to the headers of
* {@link Message}s from decoded STOMP frames. * {@link Message}s from decoded STOMP frames.
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -246,7 +246,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.emptySet()); return (rawValue != null ? StringUtils.commaDelimitedListToSet(rawValue) : Collections.emptySet());
} }
public void setHost(String host) { public void setHost(@Nullable String host) {
setNativeHeader(STOMP_HOST_HEADER, host); setNativeHeader(STOMP_HOST_HEADER, host);
} }
@ -302,7 +302,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
setNativeHeader(STOMP_HEARTBEAT_HEADER, cx + "," + cy); setNativeHeader(STOMP_HEARTBEAT_HEADER, cx + "," + cy);
} }
public void setAck(String ack) { public void setAck(@Nullable String ack) {
setNativeHeader(STOMP_ACK_HEADER, ack); setNativeHeader(STOMP_ACK_HEADER, ack);
} }
@ -311,7 +311,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return getFirstNativeHeader(STOMP_ACK_HEADER); return getFirstNativeHeader(STOMP_ACK_HEADER);
} }
public void setNack(String nack) { public void setNack(@Nullable String nack) {
setNativeHeader(STOMP_NACK_HEADER, nack); setNativeHeader(STOMP_NACK_HEADER, nack);
} }
@ -320,7 +320,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return getFirstNativeHeader(STOMP_NACK_HEADER); return getFirstNativeHeader(STOMP_NACK_HEADER);
} }
public void setLogin(String login) { public void setLogin(@Nullable String login) {
setNativeHeader(STOMP_LOGIN_HEADER, login); setNativeHeader(STOMP_LOGIN_HEADER, login);
} }
@ -329,7 +329,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return getFirstNativeHeader(STOMP_LOGIN_HEADER); return getFirstNativeHeader(STOMP_LOGIN_HEADER);
} }
public void setPasscode(String passcode) { public void setPasscode(@Nullable String passcode) {
setNativeHeader(STOMP_PASSCODE_HEADER, passcode); setNativeHeader(STOMP_PASSCODE_HEADER, passcode);
protectPasscode(); protectPasscode();
} }
@ -351,7 +351,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return (credentials != null ? credentials.passcode : null); return (credentials != null ? credentials.passcode : null);
} }
public void setReceiptId(String receiptId) { public void setReceiptId(@Nullable String receiptId) {
setNativeHeader(STOMP_RECEIPT_ID_HEADER, receiptId); setNativeHeader(STOMP_RECEIPT_ID_HEADER, receiptId);
} }
@ -360,7 +360,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return getFirstNativeHeader(STOMP_RECEIPT_ID_HEADER); return getFirstNativeHeader(STOMP_RECEIPT_ID_HEADER);
} }
public void setReceipt(String receiptId) { public void setReceipt(@Nullable String receiptId) {
setNativeHeader(STOMP_RECEIPT_HEADER, receiptId); setNativeHeader(STOMP_RECEIPT_HEADER, receiptId);
} }
@ -374,7 +374,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return getFirstNativeHeader(STOMP_MESSAGE_HEADER); return getFirstNativeHeader(STOMP_MESSAGE_HEADER);
} }
public void setMessage(String content) { public void setMessage(@Nullable String content) {
setNativeHeader(STOMP_MESSAGE_HEADER, content); setNativeHeader(STOMP_MESSAGE_HEADER, content);
} }
@ -383,7 +383,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return getFirstNativeHeader(STOMP_MESSAGE_ID_HEADER); return getFirstNativeHeader(STOMP_MESSAGE_ID_HEADER);
} }
public void setMessageId(String id) { public void setMessageId(@Nullable String id) {
setNativeHeader(STOMP_MESSAGE_ID_HEADER, id); setNativeHeader(STOMP_MESSAGE_ID_HEADER, id);
} }
@ -392,7 +392,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return getFirstNativeHeader(STOMP_VERSION_HEADER); return getFirstNativeHeader(STOMP_VERSION_HEADER);
} }
public void setVersion(String version) { public void setVersion(@Nullable String version) {
setNativeHeader(STOMP_VERSION_HEADER, version); setNativeHeader(STOMP_VERSION_HEADER, version);
} }

View File

@ -126,11 +126,16 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the content-type header. * Set the content-type header.
* Applies to the SEND, MESSAGE, and ERROR frames. * Applies to the SEND, MESSAGE, and ERROR frames.
*/ */
public void setContentType(MimeType mimeType) { public void setContentType(@Nullable MimeType mimeType) {
if (mimeType != null) {
Assert.isTrue(!mimeType.isWildcardType(), "'Content-Type' cannot contain wildcard type '*'"); Assert.isTrue(!mimeType.isWildcardType(), "'Content-Type' cannot contain wildcard type '*'");
Assert.isTrue(!mimeType.isWildcardSubtype(), "'Content-Type' cannot contain wildcard subtype '*'"); Assert.isTrue(!mimeType.isWildcardSubtype(), "'Content-Type' cannot contain wildcard subtype '*'");
set(CONTENT_TYPE, mimeType.toString()); set(CONTENT_TYPE, mimeType.toString());
} }
else {
set(CONTENT_TYPE, null);
}
}
/** /**
* Return the content-type header value. * Return the content-type header value.
@ -161,7 +166,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the receipt header. * Set the receipt header.
* Applies to any client frame other than CONNECT. * Applies to any client frame other than CONNECT.
*/ */
public void setReceipt(String receipt) { public void setReceipt(@Nullable String receipt) {
set(RECEIPT, receipt); set(RECEIPT, receipt);
} }
@ -177,7 +182,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the host header. * Set the host header.
* Applies to the CONNECT frame. * Applies to the CONNECT frame.
*/ */
public void setHost(String host) { public void setHost(@Nullable String host) {
set(HOST, host); set(HOST, host);
} }
@ -193,7 +198,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the login header. * Set the login header.
* Applies to the CONNECT frame. * Applies to the CONNECT frame.
*/ */
public void setLogin(String login) { public void setLogin(@Nullable String login) {
set(LOGIN, login); set(LOGIN, login);
} }
@ -209,7 +214,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the passcode header. * Set the passcode header.
* Applies to the CONNECT frame. * Applies to the CONNECT frame.
*/ */
public void setPasscode(String passcode) { public void setPasscode(@Nullable String passcode) {
set(PASSCODE, passcode); set(PASSCODE, passcode);
} }
@ -263,7 +268,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the session header. * Set the session header.
* Applies to the CONNECTED frame. * Applies to the CONNECTED frame.
*/ */
public void setSession(String session) { public void setSession(@Nullable String session) {
set(SESSION, session); set(SESSION, session);
} }
@ -279,7 +284,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the server header. * Set the server header.
* Applies to the CONNECTED frame. * Applies to the CONNECTED frame.
*/ */
public void setServer(String server) { public void setServer(@Nullable String server) {
set(SERVER, server); set(SERVER, server);
} }
@ -295,7 +300,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
/** /**
* Set the destination header. * Set the destination header.
*/ */
public void setDestination(String destination) { public void setDestination(@Nullable String destination) {
set(DESTINATION, destination); set(DESTINATION, destination);
} }
@ -312,7 +317,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the id header. * Set the id header.
* Applies to the SUBSCR0BE, UNSUBSCRIBE, and ACK or NACK frames. * Applies to the SUBSCR0BE, UNSUBSCRIBE, and ACK or NACK frames.
*/ */
public void setId(String id) { public void setId(@Nullable String id) {
set(ID, id); set(ID, id);
} }
@ -328,7 +333,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the ack header to one of "auto", "client", or "client-individual". * Set the ack header to one of "auto", "client", or "client-individual".
* Applies to the SUBSCRIBE and MESSAGE frames. * Applies to the SUBSCRIBE and MESSAGE frames.
*/ */
public void setAck(String ack) { public void setAck(@Nullable String ack) {
set(ACK, ack); set(ACK, ack);
} }
@ -344,7 +349,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the login header. * Set the login header.
* Applies to the MESSAGE frame. * Applies to the MESSAGE frame.
*/ */
public void setSubscription(String subscription) { public void setSubscription(@Nullable String subscription) {
set(SUBSCRIPTION, subscription); set(SUBSCRIPTION, subscription);
} }
@ -360,7 +365,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the message-id header. * Set the message-id header.
* Applies to the MESSAGE frame. * Applies to the MESSAGE frame.
*/ */
public void setMessageId(String messageId) { public void setMessageId(@Nullable String messageId) {
set(MESSAGE_ID, messageId); set(MESSAGE_ID, messageId);
} }
@ -376,7 +381,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* Set the receipt-id header. * Set the receipt-id header.
* Applies to the RECEIPT frame. * Applies to the RECEIPT frame.
*/ */
public void setReceiptId(String receiptId) { public void setReceiptId(@Nullable String receiptId) {
set(RECEIPT_ID, receiptId); set(RECEIPT_ID, receiptId);
} }
@ -433,7 +438,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
* @see #add(String, String) * @see #add(String, String)
*/ */
@Override @Override
public void set(String headerName, String headerValue) { public void set(String headerName, @Nullable String headerValue) {
List<String> headerValues = new LinkedList<>(); List<String> headerValues = new LinkedList<>();
headerValues.add(headerValue); headerValues.add(headerValue);
headers.put(headerName, headerValues); headers.put(headerName, headerValues);

View File

@ -108,7 +108,7 @@ public class UserDestinationMessageHandler implements MessageHandler, SmartLifec
* <p>By default this is not set. * <p>By default this is not set.
* @param destination the target destination. * @param destination the target destination.
*/ */
public void setBroadcastDestination(String destination) { public void setBroadcastDestination(@Nullable String destination) {
this.broadcastHandler = (StringUtils.hasText(destination) ? this.broadcastHandler = (StringUtils.hasText(destination) ?
new BroadcastHandler(this.messagingTemplate, destination) : null); new BroadcastHandler(this.messagingTemplate, destination) : null);
} }
@ -134,7 +134,7 @@ public class UserDestinationMessageHandler implements MessageHandler, SmartLifec
* headers of resolved target messages. * headers of resolved target messages.
* <p>By default this is not set. * <p>By default this is not set.
*/ */
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer; this.headerInitializer = headerInitializer;
} }

View File

@ -43,7 +43,7 @@ public class IdTimestampMessageHeaderInitializer implements MessageHeaderInitial
* IdGenerator of {@link org.springframework.messaging.MessageHeaders} is used. * IdGenerator of {@link org.springframework.messaging.MessageHeaders} is used.
* <p>To have no id's generated at all, see {@link #setDisableIdGeneration()}. * <p>To have no id's generated at all, see {@link #setDisableIdGeneration()}.
*/ */
public void setIdGenerator(IdGenerator idGenerator) { public void setIdGenerator(@Nullable IdGenerator idGenerator) {
this.idGenerator = idGenerator; this.idGenerator = idGenerator;
} }

Some files were not shown because too many files have changed in this diff Show More