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:
@@ -92,7 +92,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
|
||||
* Set the CCI ConnectionFactory that this instance should manage local
|
||||
* transactions for.
|
||||
*/
|
||||
public void setConnectionFactory(ConnectionFactory cf) {
|
||||
public void setConnectionFactory(@Nullable ConnectionFactory cf) {
|
||||
if (cf instanceof TransactionAwareConnectionFactoryProxy) {
|
||||
// If we got a TransactionAwareConnectionFactoryProxy, we need to perform transactions
|
||||
// for its underlying target ConnectionFactory, else JMS access code won't see
|
||||
|
||||
@@ -44,13 +44,14 @@ import org.springframework.util.Assert;
|
||||
@SuppressWarnings("serial")
|
||||
public class DelegatingConnectionFactory implements ConnectionFactory, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory targetConnectionFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Set the target ConnectionFactory that this ConnectionFactory should delegate to.
|
||||
*/
|
||||
public void setTargetConnectionFactory(ConnectionFactory targetConnectionFactory) {
|
||||
public void setTargetConnectionFactory(@Nullable ConnectionFactory targetConnectionFactory) {
|
||||
this.targetConnectionFactory = targetConnectionFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public class CciTemplate implements CciOperations {
|
||||
/**
|
||||
* Set the CCI ConnectionFactory to obtain Connections from.
|
||||
*/
|
||||
public void setConnectionFactory(ConnectionFactory connectionFactory) {
|
||||
public void setConnectionFactory(@Nullable ConnectionFactory connectionFactory) {
|
||||
this.connectionFactory = connectionFactory;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ public class CciTemplate implements CciOperations {
|
||||
* Set the CCI ConnectionSpec that this template instance is
|
||||
* supposed to obtain Connections for.
|
||||
*/
|
||||
public void setConnectionSpec(ConnectionSpec connectionSpec) {
|
||||
public void setConnectionSpec(@Nullable ConnectionSpec connectionSpec) {
|
||||
this.connectionSpec = connectionSpec;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ public class CciTemplate implements CciOperations {
|
||||
* @see javax.resource.cci.Interaction#execute(javax.resource.cci.InteractionSpec, Record)
|
||||
* @see javax.resource.cci.Interaction#execute(javax.resource.cci.InteractionSpec, Record, Record)
|
||||
*/
|
||||
public void setOutputRecordCreator(RecordCreator creator) {
|
||||
public void setOutputRecordCreator(@Nullable RecordCreator creator) {
|
||||
this.outputRecordCreator = creator;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public abstract class EisOperation implements InitializingBean {
|
||||
/**
|
||||
* Set the CCI InteractionSpec for this operation.
|
||||
*/
|
||||
public void setInteractionSpec(InteractionSpec interactionSpec) {
|
||||
public void setInteractionSpec(@Nullable InteractionSpec interactionSpec) {
|
||||
this.interactionSpec = interactionSpec;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,10 +148,13 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class GenericMessageEndpointManager implements SmartLifecycle, InitializingBean, DisposableBean {
|
||||
|
||||
@Nullable
|
||||
private ResourceAdapter resourceAdapter;
|
||||
|
||||
@Nullable
|
||||
private MessageEndpointFactory messageEndpointFactory;
|
||||
|
||||
@Nullable
|
||||
private ActivationSpec activationSpec;
|
||||
|
||||
private boolean autoStartup = true;
|
||||
@@ -166,7 +169,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
|
||||
/**
|
||||
* Set the JCA ResourceAdapter to manage endpoints for.
|
||||
*/
|
||||
public void setResourceAdapter(ResourceAdapter resourceAdapter) {
|
||||
public void setResourceAdapter(@Nullable ResourceAdapter resourceAdapter) {
|
||||
this.resourceAdapter = resourceAdapter;
|
||||
}
|
||||
|
||||
@@ -186,7 +189,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
|
||||
* with different {@link #setActivationSpec ActivationSpec} objects applied.
|
||||
* @see GenericMessageEndpointFactory#setMessageListener
|
||||
*/
|
||||
public void setMessageEndpointFactory(MessageEndpointFactory messageEndpointFactory) {
|
||||
public void setMessageEndpointFactory(@Nullable MessageEndpointFactory messageEndpointFactory) {
|
||||
this.messageEndpointFactory = messageEndpointFactory;
|
||||
}
|
||||
|
||||
@@ -203,7 +206,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
|
||||
* <p>Note that this ActivationSpec instance should not be shared
|
||||
* across multiple ResourceAdapter instances.
|
||||
*/
|
||||
public void setActivationSpec(ActivationSpec activationSpec) {
|
||||
public void setActivationSpec(@Nullable ActivationSpec activationSpec) {
|
||||
this.activationSpec = activationSpec;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
|
||||
* e.g. indicating where the attribute is applying.
|
||||
* @since 4.3.4
|
||||
*/
|
||||
public void setDescriptor(String descriptor) {
|
||||
public void setDescriptor(@Nullable String descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
/**
|
||||
* Specify the name of the default transaction manager bean.
|
||||
*/
|
||||
public void setTransactionManagerBeanName(String transactionManagerBeanName) {
|
||||
public void setTransactionManagerBeanName(@Nullable String transactionManagerBeanName) {
|
||||
this.transactionManagerBeanName = transactionManagerBeanName;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* default transaction manager bean has not been specified.
|
||||
* @see #setTransactionManagerBeanName
|
||||
*/
|
||||
public void setTransactionManager(PlatformTransactionManager transactionManager) {
|
||||
public void setTransactionManager(@Nullable PlatformTransactionManager transactionManager) {
|
||||
this.transactionManager = transactionManager;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* @see NameMatchTransactionAttributeSource
|
||||
* @see org.springframework.transaction.annotation.AnnotationTransactionAttributeSource
|
||||
*/
|
||||
public void setTransactionAttributeSource(TransactionAttributeSource transactionAttributeSource) {
|
||||
public void setTransactionAttributeSource(@Nullable TransactionAttributeSource transactionAttributeSource) {
|
||||
this.transactionAttributeSource = transactionAttributeSource;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* Set the BeanFactory to use for retrieving PlatformTransactionManager beans.
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
public void setBeanFactory(@Nullable BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* Creates a JndiTemplate with the given environment settings.
|
||||
* @see #setJndiTemplate
|
||||
*/
|
||||
public void setJndiEnvironment(Properties jndiEnvironment) {
|
||||
public void setJndiEnvironment(@Nullable Properties jndiEnvironment) {
|
||||
this.jndiTemplate = new JndiTemplate(jndiEnvironment);
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* @see #setUserTransactionName
|
||||
* @see #setAutodetectUserTransaction
|
||||
*/
|
||||
public void setUserTransaction(UserTransaction userTransaction) {
|
||||
public void setUserTransaction(@Nullable UserTransaction userTransaction) {
|
||||
this.userTransaction = userTransaction;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* @see #setTransactionManagerName
|
||||
* @see #setAutodetectTransactionManager
|
||||
*/
|
||||
public void setTransactionManager(TransactionManager transactionManager) {
|
||||
public void setTransactionManager(@Nullable TransactionManager transactionManager) {
|
||||
this.transactionManager = transactionManager;
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* @see #setTransactionSynchronizationRegistryName
|
||||
* @see #setAutodetectTransactionSynchronizationRegistry
|
||||
*/
|
||||
public void setTransactionSynchronizationRegistry(TransactionSynchronizationRegistry transactionSynchronizationRegistry) {
|
||||
public void setTransactionSynchronizationRegistry(@Nullable TransactionSynchronizationRegistry transactionSynchronizationRegistry) {
|
||||
this.transactionSynchronizationRegistry = transactionSynchronizationRegistry;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
|
||||
/**
|
||||
* Set the transaction management strategy to be used.
|
||||
*/
|
||||
public void setTransactionManager(PlatformTransactionManager transactionManager) {
|
||||
public void setTransactionManager(@Nullable PlatformTransactionManager transactionManager) {
|
||||
this.transactionManager = transactionManager;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user