Add Nullability support into Java DSL

This commit is contained in:
abilan
2023-04-14 14:16:36 -04:00
parent 053cc00484
commit d5181bf0d7
105 changed files with 514 additions and 366 deletions

View File

@@ -55,7 +55,9 @@ public final class Jms {
*/
public static JmsPollableMessageChannelSpec<?, PollableJmsChannel> pollableChannel(@Nullable String id,
ConnectionFactory connectionFactory) {
JmsPollableMessageChannelSpec<?, PollableJmsChannel> spec = new JmsPollableMessageChannelSpec<>(connectionFactory);
JmsPollableMessageChannelSpec<?, PollableJmsChannel> spec =
new JmsPollableMessageChannelSpec<>(connectionFactory);
return spec.id(id);
}
@@ -166,14 +168,9 @@ public final class Jms {
public static JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<JmsDefaultListenerContainerSpec, DefaultMessageListenerContainer>
inboundGateway(ConnectionFactory connectionFactory) {
try {
return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<>(
new JmsDefaultListenerContainerSpec()
.connectionFactory(connectionFactory));
}
catch (Exception e) {
throw new IllegalStateException(e);
}
return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<>(
new JmsDefaultListenerContainerSpec()
.connectionFactory(connectionFactory));
}
/**
@@ -189,15 +186,10 @@ public final class Jms {
JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<?, C> inboundGateway(
ConnectionFactory connectionFactory, Class<C> containerClass) {
try {
JmsListenerContainerSpec<?, C> spec =
new JmsListenerContainerSpec<>(containerClass)
.connectionFactory(connectionFactory);
return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec(spec);
}
catch (Exception e) {
throw new IllegalStateException(e);
}
JmsListenerContainerSpec<?, C> spec =
new JmsListenerContainerSpec<>(containerClass)
.connectionFactory(connectionFactory);
return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec(spec);
}
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import jakarta.jms.ConnectionFactory;
import org.springframework.integration.dsl.IntegrationComponentSpec;
import org.springframework.jms.support.destination.DestinationResolver;
import org.springframework.jms.support.destination.JmsDestinationAccessor;
import org.springframework.lang.Nullable;
/**
* A base {@link IntegrationComponentSpec} for {@link JmsDestinationAccessor}s.
@@ -45,7 +46,7 @@ public abstract class JmsDestinationAccessorSpec<S extends JmsDestinationAccesso
}
@Override
public S id(String id) { // NOSONAR - not useless, increases visibility
public S id(@Nullable String id) { // NOSONAR - not useless, increases visibility
return super.id(id);
}

View File

@@ -1,4 +1,6 @@
/**
* Provides JMS Component support for the Java DSL.
*/
@org.springframework.lang.NonNullApi
@org.springframework.lang.NonNullFields
package org.springframework.integration.jms.dsl;