Browse Source

Add nullability annotations to module/spring-boot-activemq

See gh-46587
pull/46595/head
Moritz Halbritter 8 months ago
parent
commit
2d256c244e
  1. 5
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQAutoConfiguration.java
  2. 6
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQConnectionDetails.java
  3. 3
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQConnectionFactoryConfigurer.java
  4. 26
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQProperties.java
  5. 3
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/package-info.java
  6. 6
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQClassicDockerComposeConnectionDetailsFactory.java
  7. 10
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQClassicEnvironment.java
  8. 6
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQDockerComposeConnectionDetailsFactory.java
  9. 10
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQEnvironment.java
  10. 3
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/package-info.java
  11. 5
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/testcontainers/ActiveMQContainerConnectionDetailsFactory.java
  12. 3
      module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/testcontainers/package-info.java

5
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQAutoConfiguration.java

@ -18,6 +18,7 @@ package org.springframework.boot.activemq.autoconfigure; @@ -18,6 +18,7 @@ package org.springframework.boot.activemq.autoconfigure;
import jakarta.jms.ConnectionFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -71,12 +72,12 @@ public final class ActiveMQAutoConfiguration { @@ -71,12 +72,12 @@ public final class ActiveMQAutoConfiguration {
}
@Override
public String getUser() {
public @Nullable String getUser() {
return this.properties.getUser();
}
@Override
public String getPassword() {
public @Nullable String getPassword() {
return this.properties.getPassword();
}

6
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQConnectionDetails.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.boot.activemq.autoconfigure;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
/**
@ -37,12 +39,12 @@ public interface ActiveMQConnectionDetails extends ConnectionDetails { @@ -37,12 +39,12 @@ public interface ActiveMQConnectionDetails extends ConnectionDetails {
* Login user to authenticate to the broker.
* @return the login user to authenticate to the broker or {@code null}
*/
String getUser();
@Nullable String getUser();
/**
* Login to authenticate against the broker.
* @return the login to authenticate against the broker or {@code null}
*/
String getPassword();
@Nullable String getPassword();
}

3
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQConnectionFactoryConfigurer.java

@ -20,6 +20,7 @@ import java.util.Collections; @@ -20,6 +20,7 @@ import java.util.Collections;
import java.util.List;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.activemq.autoconfigure.ActiveMQProperties.Packages;
import org.springframework.util.Assert;
@ -40,7 +41,7 @@ class ActiveMQConnectionFactoryConfigurer { @@ -40,7 +41,7 @@ class ActiveMQConnectionFactoryConfigurer {
private final List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers;
ActiveMQConnectionFactoryConfigurer(ActiveMQProperties properties,
List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
@Nullable List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
Assert.notNull(properties, "'properties' must not be null");
this.properties = properties;
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers : Collections.emptyList();

26
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQProperties.java

@ -20,6 +20,8 @@ import java.time.Duration; @@ -20,6 +20,8 @@ import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties;
@ -44,17 +46,17 @@ public class ActiveMQProperties { @@ -44,17 +46,17 @@ public class ActiveMQProperties {
/**
* URL of the ActiveMQ broker. Auto-generated by default.
*/
private String brokerUrl;
private @Nullable String brokerUrl;
/**
* Login user of the broker.
*/
private String user;
private @Nullable String user;
/**
* Login password of the broker.
*/
private String password;
private @Nullable String password;
private final Embedded embedded = new Embedded();
@ -79,27 +81,27 @@ public class ActiveMQProperties { @@ -79,27 +81,27 @@ public class ActiveMQProperties {
private final Packages packages = new Packages();
public String getBrokerUrl() {
public @Nullable String getBrokerUrl() {
return this.brokerUrl;
}
public void setBrokerUrl(String brokerUrl) {
public void setBrokerUrl(@Nullable String brokerUrl) {
this.brokerUrl = brokerUrl;
}
public String getUser() {
public @Nullable String getUser() {
return this.user;
}
public void setUser(String user) {
public void setUser(@Nullable String user) {
this.user = user;
}
public String getPassword() {
public @Nullable String getPassword() {
return this.password;
}
public void setPassword(String password) {
public void setPassword(@Nullable String password) {
this.password = password;
}
@ -174,18 +176,18 @@ public class ActiveMQProperties { @@ -174,18 +176,18 @@ public class ActiveMQProperties {
/**
* Whether to trust all packages.
*/
private Boolean trustAll;
private @Nullable Boolean trustAll;
/**
* List of specific packages to trust (when not trusting all packages).
*/
private List<String> trusted = new ArrayList<>();
public Boolean getTrustAll() {
public @Nullable Boolean getTrustAll() {
return this.trustAll;
}
public void setTrustAll(Boolean trustAll) {
public void setTrustAll(@Nullable Boolean trustAll) {
this.trustAll = trustAll;
}

3
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/package-info.java

@ -17,4 +17,7 @@ @@ -17,4 +17,7 @@
/**
* Auto-configuration for ActiveMQ.
*/
@NullMarked
package org.springframework.boot.activemq.autoconfigure;
import org.jspecify.annotations.NullMarked;

6
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQClassicDockerComposeConnectionDetailsFactory.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.boot.activemq.docker.compose;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.activemq.autoconfigure.ActiveMQConnectionDetails;
import org.springframework.boot.docker.compose.core.RunningService;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
@ -65,12 +67,12 @@ class ActiveMQClassicDockerComposeConnectionDetailsFactory @@ -65,12 +67,12 @@ class ActiveMQClassicDockerComposeConnectionDetailsFactory
}
@Override
public String getUser() {
public @Nullable String getUser() {
return this.environment.getUser();
}
@Override
public String getPassword() {
public @Nullable String getPassword() {
return this.environment.getPassword();
}

10
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQClassicEnvironment.java

@ -18,6 +18,8 @@ package org.springframework.boot.activemq.docker.compose; @@ -18,6 +18,8 @@ package org.springframework.boot.activemq.docker.compose;
import java.util.Map;
import org.jspecify.annotations.Nullable;
/**
* ActiveMQ environment details.
*
@ -26,20 +28,20 @@ import java.util.Map; @@ -26,20 +28,20 @@ import java.util.Map;
*/
class ActiveMQClassicEnvironment {
private final String user;
private final @Nullable String user;
private final String password;
private final @Nullable String password;
ActiveMQClassicEnvironment(Map<String, String> env) {
this.user = env.get("ACTIVEMQ_CONNECTION_USER");
this.password = env.get("ACTIVEMQ_CONNECTION_PASSWORD");
}
String getUser() {
@Nullable String getUser() {
return this.user;
}
String getPassword() {
@Nullable String getPassword() {
return this.password;
}

6
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQDockerComposeConnectionDetailsFactory.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.boot.activemq.docker.compose;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.activemq.autoconfigure.ActiveMQConnectionDetails;
import org.springframework.boot.docker.compose.core.RunningService;
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
@ -64,12 +66,12 @@ class ActiveMQDockerComposeConnectionDetailsFactory @@ -64,12 +66,12 @@ class ActiveMQDockerComposeConnectionDetailsFactory
}
@Override
public String getUser() {
public @Nullable String getUser() {
return this.environment.getUser();
}
@Override
public String getPassword() {
public @Nullable String getPassword() {
return this.environment.getPassword();
}

10
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQEnvironment.java

@ -18,6 +18,8 @@ package org.springframework.boot.activemq.docker.compose; @@ -18,6 +18,8 @@ package org.springframework.boot.activemq.docker.compose;
import java.util.Map;
import org.jspecify.annotations.Nullable;
/**
* ActiveMQ environment details.
*
@ -25,20 +27,20 @@ import java.util.Map; @@ -25,20 +27,20 @@ import java.util.Map;
*/
class ActiveMQEnvironment {
private final String user;
private final @Nullable String user;
private final String password;
private final @Nullable String password;
ActiveMQEnvironment(Map<String, String> env) {
this.user = env.get("ACTIVEMQ_USERNAME");
this.password = env.get("ACTIVEMQ_PASSWORD");
}
String getUser() {
@Nullable String getUser() {
return this.user;
}
String getPassword() {
@Nullable String getPassword() {
return this.password;
}

3
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/package-info.java

@ -17,4 +17,7 @@ @@ -17,4 +17,7 @@
/**
* Support for Docker Compose ActiveMQ service connections.
*/
@NullMarked
package org.springframework.boot.activemq.docker.compose;
import org.jspecify.annotations.NullMarked;

5
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/testcontainers/ActiveMQContainerConnectionDetailsFactory.java

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.boot.activemq.testcontainers;
import org.jspecify.annotations.Nullable;
import org.testcontainers.containers.Container;
import org.testcontainers.containers.GenericContainer;
@ -56,12 +57,12 @@ class ActiveMQContainerConnectionDetailsFactory @@ -56,12 +57,12 @@ class ActiveMQContainerConnectionDetailsFactory
}
@Override
public String getUser() {
public @Nullable String getUser() {
return getContainer().getEnvMap().get("ACTIVEMQ_USERNAME");
}
@Override
public String getPassword() {
public @Nullable String getPassword() {
return getContainer().getEnvMap().get("ACTIVEMQ_PASSWORD");
}

3
module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/testcontainers/package-info.java

@ -17,4 +17,7 @@ @@ -17,4 +17,7 @@
/**
* Support for testcontainers ActiveMQ service connections.
*/
@NullMarked
package org.springframework.boot.activemq.testcontainers;
import org.jspecify.annotations.NullMarked;

Loading…
Cancel
Save