Skip to content

Commit 2e095a1

Browse files
committed
Polishing - PR Comments
Remove unnecessary generics.
1 parent 34e2318 commit 2e095a1

13 files changed

+80
-112
lines changed

spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/AbstractConnectionFactorySpec.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ public abstract class AbstractConnectionFactorySpec
3939
<S extends AbstractConnectionFactorySpec<S, C>, C extends AbstractConnectionFactory>
4040
extends IntegrationComponentSpec<S, C> {
4141

42-
protected C target;
43-
44-
public AbstractConnectionFactorySpec(C connectionFactory) {
42+
AbstractConnectionFactorySpec(C connectionFactory) {
4543
this.target = connectionFactory;
4644
}
4745

4846
@Override
4947
public S id(String id) {
50-
return super.id(id);
48+
this.target.setBeanName(id);
49+
return _this();
5150
}
5251

5352
/**
@@ -221,12 +220,4 @@ public S tcpSocketSupport(TcpSocketSupport tcpSocketSupport) {
221220
return _this();
222221
}
223222

224-
@Override
225-
protected C doGet() {
226-
if (getId() != null) {
227-
this.target.setBeanName(getId());
228-
}
229-
return this.target;
230-
}
231-
232223
}

spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Tcp.java

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory;
2020
import org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory;
21-
import org.springframework.integration.ip.tcp.connection.AbstractServerConnectionFactory;
2221

2322
/**
2423
* Factory methods for TCP.
@@ -47,67 +46,73 @@ private Tcp() {
4746
/**
4847
* Create a server spec that uses NIO.
4948
* @param port the port to listen on.
50-
* @param <S> the spec type.
51-
* @param <C> the connection factrory type.
5249
* @return the spec.
5350
*/
54-
public static <S extends TcpServerConnectionFactorySpec<S, C>, C extends AbstractServerConnectionFactory>
55-
TcpServerConnectionFactorySpec<S, C> nioServer(int port) {
56-
return new TcpServerConnectionFactorySpec<>(port, NIO);
51+
public static TcpServerConnectionFactorySpec nioServer(int port) {
52+
return new TcpServerConnectionFactorySpec(port, NIO);
5753
}
5854

5955
/**
6056
* Create a server spec that does not use NIO.
6157
* @param port the port to listen on.
62-
* @param <S> the spec type.
63-
* @param <C> the connection factrory type.
6458
* @return the spec.
6559
*/
66-
public static <S extends TcpServerConnectionFactorySpec<S, C>, C extends AbstractServerConnectionFactory>
67-
TcpServerConnectionFactorySpec<S, C> netServer(int port) {
68-
return new TcpServerConnectionFactorySpec<>(port, NET);
60+
public static TcpServerConnectionFactorySpec netServer(int port) {
61+
return new TcpServerConnectionFactorySpec(port, NET);
6962
}
7063

7164
/**
7265
* Create a client spec that uses NIO.
7366
* @param host the host to connect to.
7467
* @param port the port to connect to.
75-
* @param <S> the spec type.
76-
* @param <C> the connection factrory type.
7768
* @return the spec.
7869
*/
79-
public static <S extends TcpClientConnectionFactorySpec<S, C>, C extends AbstractClientConnectionFactory>
80-
TcpClientConnectionFactorySpec<S, C> nioClient(String host, int port) {
81-
return new TcpClientConnectionFactorySpec<>(host, port, NIO);
70+
public static TcpClientConnectionFactorySpec nioClient(String host, int port) {
71+
return new TcpClientConnectionFactorySpec(host, port, NIO);
8272
}
8373

8474
/**
8575
* Create a client spec that does not use NIO.
8676
* @param host the host to connect to.
8777
* @param port the port to connect to.
88-
* @param <S> the spec type.
89-
* @param <C> the connection factrory type.
9078
* @return the spec.
9179
*/
92-
public static <S extends TcpClientConnectionFactorySpec<S, C>, C extends AbstractClientConnectionFactory>
93-
TcpClientConnectionFactorySpec<S, C> netClient(String host, int port) {
94-
return new TcpClientConnectionFactorySpec<>(host, port, NET);
80+
public static TcpClientConnectionFactorySpec netClient(String host, int port) {
81+
return new TcpClientConnectionFactorySpec(host, port, NET);
9582
}
9683

97-
public static <S extends TcpInboundGatewaySpec<S>> TcpInboundGatewaySpec<S> inboundGateway(
98-
AbstractConnectionFactory connectionFactory) {
99-
return new TcpInboundGatewaySpec<>(connectionFactory);
84+
/**
85+
* Create an inbound gateway using the supplied connection factory.
86+
* @param connectionFactory the connection factory.
87+
* @return the spec.
88+
*/
89+
public static TcpInboundGatewaySpec inboundGateway(AbstractConnectionFactory connectionFactory) {
90+
return new TcpInboundGatewaySpec(connectionFactory);
10091
}
10192

102-
public static <S extends TcpInboundChannelAdapterSpec<S>> TcpInboundChannelAdapterSpec<S> inboundAdapter(
103-
AbstractConnectionFactory connectionFactory) {
104-
return new TcpInboundChannelAdapterSpec<>(connectionFactory);
93+
/**
94+
* Create an inbound channel adapter using the supplied connection factory.
95+
* @param connectionFactory the connection factory.
96+
* @return the spec.
97+
*/
98+
public static TcpInboundChannelAdapterSpec inboundAdapter(AbstractConnectionFactory connectionFactory) {
99+
return new TcpInboundChannelAdapterSpec(connectionFactory);
105100
}
106101

102+
/**
103+
* Create an outbound gateway using the supplied client connection factory.
104+
* @param connectionFactory the connection factory.
105+
* @return the spec.
106+
*/
107107
public static TcpOutboundGatewaySpec outboundGateway(AbstractClientConnectionFactory connectionFactory) {
108108
return new TcpOutboundGatewaySpec(connectionFactory);
109109
}
110110

111+
/**
112+
* Create an outbound gateway using the supplied connection factory.
113+
* @param connectionFactory the connection factory.
114+
* @return the spec.
115+
*/
111116
public static TcpOutboundChannelAdapterSpec outboundAdapter(AbstractConnectionFactory connectionFactory) {
112117
return new TcpOutboundChannelAdapterSpec(connectionFactory);
113118
}

spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/TcpClientConnectionFactorySpec.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,17 @@
2525
* An {@link IntegrationComponentSpec} for {@link AbstractClientConnectionFactory}s.
2626
* @author Gary Russell
2727
*
28-
* @param <S> the target {@link TcpClientConnectionFactorySpec} implementation type.
29-
* @param <C> the target {@link AbstractClientConnectionFactory} implementation type.
30-
*
3128
* @since 5.0
3229
*
3330
*/
3431
public class TcpClientConnectionFactorySpec
35-
<S extends TcpClientConnectionFactorySpec<S, C>, C extends AbstractClientConnectionFactory>
36-
extends AbstractConnectionFactorySpec<S, AbstractClientConnectionFactory> {
32+
extends AbstractConnectionFactorySpec<TcpClientConnectionFactorySpec, AbstractClientConnectionFactory> {
3733

3834
TcpClientConnectionFactorySpec(String host, int port) {
3935
this(host, port, false);
4036
}
4137

42-
public TcpClientConnectionFactorySpec(String host, int port, boolean nio) {
38+
TcpClientConnectionFactorySpec(String host, int port, boolean nio) {
4339
super(nio ? new TcpNioClientConnectionFactory(host, port) : new TcpNetClientConnectionFactory(host, port));
4440
}
4541

spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/TcpInboundChannelAdapterSpec.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
* @since 5.0
2929
*
3030
*/
31-
public class TcpInboundChannelAdapterSpec<S extends TcpInboundChannelAdapterSpec<S>>
32-
extends MessageProducerSpec<S, TcpReceivingChannelAdapter> {
31+
public class TcpInboundChannelAdapterSpec
32+
extends MessageProducerSpec<TcpInboundChannelAdapterSpec, TcpReceivingChannelAdapter> {
3333

3434
TcpInboundChannelAdapterSpec(AbstractConnectionFactory connectionFactory) {
3535
super(new TcpReceivingChannelAdapter());
@@ -41,7 +41,7 @@ public class TcpInboundChannelAdapterSpec<S extends TcpInboundChannelAdapterSpec
4141
* @return the spec.
4242
* @see TcpReceivingChannelAdapter#setClientMode(boolean)
4343
*/
44-
public S clientMode(boolean isClientMode) {
44+
public TcpInboundChannelAdapterSpec clientMode(boolean isClientMode) {
4545
this.target.setClientMode(isClientMode);
4646
return _this();
4747
}
@@ -51,7 +51,7 @@ public S clientMode(boolean isClientMode) {
5151
* @return the spec.
5252
* @see TcpReceivingChannelAdapter#setRetryInterval(long)
5353
*/
54-
public S retryInterval(long retryInterval) {
54+
public TcpInboundChannelAdapterSpec retryInterval(long retryInterval) {
5555
this.target.setRetryInterval(retryInterval);
5656
return _this();
5757
}
@@ -61,7 +61,7 @@ public S retryInterval(long retryInterval) {
6161
* @return the spec.
6262
* @see TcpReceivingChannelAdapter#setTaskScheduler(TaskScheduler)
6363
*/
64-
public S taskScheduler(TaskScheduler taskScheduler) {
64+
public TcpInboundChannelAdapterSpec taskScheduler(TaskScheduler taskScheduler) {
6565
this.target.setTaskScheduler(taskScheduler);
6666
return _this();
6767
}

spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/TcpInboundGatewaySpec.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
* @since 5.0
2929
*
3030
*/
31-
public class TcpInboundGatewaySpec<S extends TcpInboundGatewaySpec<S>>
32-
extends MessagingGatewaySpec<S, TcpInboundGateway> {
31+
public class TcpInboundGatewaySpec extends MessagingGatewaySpec<TcpInboundGatewaySpec, TcpInboundGateway> {
3332

3433
TcpInboundGatewaySpec(AbstractConnectionFactory connectionFactory) {
3534
super(new TcpInboundGateway());
@@ -41,7 +40,7 @@ public class TcpInboundGatewaySpec<S extends TcpInboundGatewaySpec<S>>
4140
* @return the spec.
4241
* @see TcpInboundGateway#setClientMode(boolean)
4342
*/
44-
public S clientMode(boolean isClientMode) {
43+
public TcpInboundGatewaySpec clientMode(boolean isClientMode) {
4544
this.target.setClientMode(isClientMode);
4645
return _this();
4746
}
@@ -51,7 +50,7 @@ public S clientMode(boolean isClientMode) {
5150
* @return the spec.
5251
* @see TcpInboundGateway#setRetryInterval(long)
5352
*/
54-
public S retryInterval(long retryInterval) {
53+
public TcpInboundGatewaySpec retryInterval(long retryInterval) {
5554
this.target.setRetryInterval(retryInterval);
5655
return _this();
5756
}
@@ -61,7 +60,7 @@ public S retryInterval(long retryInterval) {
6160
* @return the spec.
6261
* @see TcpInboundGateway#setTaskScheduler(TaskScheduler)
6362
*/
64-
public S taskScheduler(TaskScheduler taskScheduler) {
63+
public TcpInboundGatewaySpec taskScheduler(TaskScheduler taskScheduler) {
6564
this.target.setTaskScheduler(taskScheduler);
6665
return _this();
6766
}

spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/TcpServerConnectionFactorySpec.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,17 @@
2525
* An {@link IntegrationComponentSpec} for {@link AbstractServerConnectionFactory}s.
2626
* @author Gary Russell
2727
*
28-
* @param <S> the target {@link TcpServerConnectionFactorySpec} implementation type.
29-
* @param <C> the target {@link AbstractServerConnectionFactory} implementation type.
30-
*
3128
* @since 5.0
3229
*
3330
*/
3431
public class TcpServerConnectionFactorySpec
35-
<S extends TcpServerConnectionFactorySpec<S, C>, C extends AbstractServerConnectionFactory>
36-
extends AbstractConnectionFactorySpec<S, AbstractServerConnectionFactory> {
32+
extends AbstractConnectionFactorySpec<TcpServerConnectionFactorySpec, AbstractServerConnectionFactory> {
3733

3834
TcpServerConnectionFactorySpec(int port) {
3935
this(port, false);
4036
}
4137

42-
public TcpServerConnectionFactorySpec(int port, boolean nio) {
38+
TcpServerConnectionFactorySpec(int port, boolean nio) {
4339
super(nio ? new TcpNioServerConnectionFactory(port) : new TcpNetServerConnectionFactory(port));
4440
}
4541

@@ -48,7 +44,7 @@ public TcpServerConnectionFactorySpec(int port, boolean nio) {
4844
* @return the spec.
4945
* @see AbstractServerConnectionFactory#setLocalAddress(String)
5046
*/
51-
public S localAddress(String localAddress) {
47+
public TcpServerConnectionFactorySpec localAddress(String localAddress) {
5248
this.target.setLocalAddress(localAddress);
5349
return _this();
5450
}
@@ -58,7 +54,7 @@ public S localAddress(String localAddress) {
5854
* @return the spec.
5955
* @see AbstractServerConnectionFactory#setBacklog(int)
6056
*/
61-
public S backlog(int backlog) {
57+
public TcpServerConnectionFactorySpec backlog(int backlog) {
6258
this.target.setBacklog(backlog);
6359
return _this();
6460
}

spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Udp.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,20 @@ private Udp() {
2929
super();
3030
}
3131

32-
public static <S extends UdpInboundChannelAdapterSpec<S>> UdpInboundChannelAdapterSpec<S> inboundAdapter(
33-
int port) {
34-
return new UdpInboundChannelAdapterSpec<>(port);
32+
public static UdpInboundChannelAdapterSpec inboundAdapter(int port) {
33+
return new UdpInboundChannelAdapterSpec(port);
3534
}
3635

37-
public static <S extends UdpInboundChannelAdapterSpec<S>> UdpInboundChannelAdapterSpec<S> inboundMulticastAdapter(
38-
int port, String multicastGroup) {
39-
return new UdpInboundChannelAdapterSpec<>(port, multicastGroup);
36+
public static UdpInboundChannelAdapterSpec inboundMulticastAdapter(int port, String multicastGroup) {
37+
return new UdpInboundChannelAdapterSpec(port, multicastGroup);
4038
}
4139

4240
public static UdpOutboundChannelAdapterSpec outboundAdapter(String destinationExpression) {
4341
return new UdpOutboundChannelAdapterSpec(destinationExpression);
4442
}
4543

46-
public static UdpOutboundChannelAdapterSpec outboundMultcastAdapter(String destinationExpression) {
47-
return new UdpOutboundChannelAdapterSpec(destinationExpression);
44+
public static UdpOutboundChannelAdapterSpec outboundMulticastAdapter(String destinationExpression) {
45+
return new UdpMulticastOutboundChannelAdapterSpec(destinationExpression);
4846
}
4947

5048
}

0 commit comments

Comments
 (0)