11/*
2- * Copyright 2014-2017 the original author or authors.
2+ * Copyright 2014-2018 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -36,47 +36,40 @@ public final class Jms {
3636 /**
3737 * The factory to produce a {@link JmsPollableMessageChannelSpec}.
3838 * @param connectionFactory the JMS ConnectionFactory to build on
39- * @param <S> the {@link JmsPollableMessageChannelSpec} inheritor type
4039 * @return the {@link JmsPollableMessageChannelSpec} instance
4140 */
42- public static <S extends JmsPollableMessageChannelSpec <S >> JmsPollableMessageChannelSpec <S > pollableChannel (
43- ConnectionFactory connectionFactory ) {
41+ public static JmsPollableMessageChannelSpec <?> pollableChannel (ConnectionFactory connectionFactory ) {
4442 return pollableChannel (null , connectionFactory );
4543 }
4644
4745 /**
4846 * The factory to produce a {@link JmsPollableMessageChannelSpec}.
4947 * @param id the bean name for the target {@code PollableChannel} component
5048 * @param connectionFactory the JMS ConnectionFactory to build on
51- * @param <S> the {@link JmsPollableMessageChannelSpec} inheritor type
5249 * @return the {@link JmsPollableMessageChannelSpec} instance
5350 */
54- public static <S extends JmsPollableMessageChannelSpec <S >> JmsPollableMessageChannelSpec <S > pollableChannel (
55- String id , ConnectionFactory connectionFactory ) {
56- return new JmsPollableMessageChannelSpec <S >(connectionFactory ).id (id );
51+ public static JmsPollableMessageChannelSpec <?> pollableChannel (String id , ConnectionFactory connectionFactory ) {
52+ return new JmsPollableMessageChannelSpec <>(connectionFactory ).id (id );
5753 }
5854
5955 /**
6056 * The factory to produce a {@link JmsMessageChannelSpec}.
6157 * @param connectionFactory the JMS ConnectionFactory to build on
62- * @param <S> the {@link JmsMessageChannelSpec} inheritor type
6358 * @return the {@link JmsMessageChannelSpec} instance
6459 */
65- public static <S extends JmsMessageChannelSpec <S >> JmsMessageChannelSpec <S > channel (
66- ConnectionFactory connectionFactory ) {
60+ public static JmsMessageChannelSpec <?> channel (ConnectionFactory connectionFactory ) {
6761 return channel (null , connectionFactory );
6862 }
6963
7064 /**
7165 * The factory to produce a {@link JmsMessageChannelSpec}.
7266 * @param id the bean name for the target {@code MessageChannel} component
7367 * @param connectionFactory the JMS ConnectionFactory to build on
74- * @param <S> the {@link JmsMessageChannelSpec} inheritor type
7568 * @return the {@link JmsMessageChannelSpec} instance
7669 */
77- public static < S extends JmsMessageChannelSpec <S >> JmsMessageChannelSpec < S > channel (String id ,
78- ConnectionFactory connectionFactory ) {
79- return new JmsMessageChannelSpec < S >( connectionFactory ) .id (id );
70+ public static JmsMessageChannelSpec <?> channel (String id , ConnectionFactory connectionFactory ) {
71+ return new JmsMessageChannelSpec <>( connectionFactory )
72+ .id (id );
8073 }
8174
8275 /**
@@ -96,18 +89,17 @@ public static JmsPublishSubscribeMessageChannelSpec publishSubscribeChannel(Conn
9689 */
9790 public static JmsPublishSubscribeMessageChannelSpec publishSubscribeChannel (String id ,
9891 ConnectionFactory connectionFactory ) {
92+
9993 return new JmsPublishSubscribeMessageChannelSpec (connectionFactory ).id (id );
10094 }
10195
10296 /**
10397 * The factory to produce a {@link JmsOutboundChannelAdapterSpec}.
10498 * @param jmsTemplate the JmsTemplate to build on
105- * @param <S> the {@link JmsOutboundChannelAdapterSpec} inheritor type
10699 * @return the {@link JmsOutboundChannelAdapterSpec} instance
107100 */
108- public static <S extends JmsOutboundChannelAdapterSpec <S >> JmsOutboundChannelAdapterSpec <S > outboundAdapter (
109- JmsTemplate jmsTemplate ) {
110- return new JmsOutboundChannelAdapterSpec <S >(jmsTemplate );
101+ public static JmsOutboundChannelAdapterSpec <?> outboundAdapter (JmsTemplate jmsTemplate ) {
102+ return new JmsOutboundChannelAdapterSpec <>(jmsTemplate );
111103 }
112104
113105 /**
@@ -117,18 +109,17 @@ public static <S extends JmsOutboundChannelAdapterSpec<S>> JmsOutboundChannelAda
117109 */
118110 public static JmsOutboundChannelAdapterSpec .JmsOutboundChannelSpecTemplateAware outboundAdapter (
119111 ConnectionFactory connectionFactory ) {
112+
120113 return new JmsOutboundChannelAdapterSpec .JmsOutboundChannelSpecTemplateAware (connectionFactory );
121114 }
122115
123116 /**
124117 * The factory to produce a {@link JmsInboundChannelAdapterSpec}.
125118 * @param jmsTemplate the JmsTemplate to build on
126- * @param <S> the {@link JmsInboundChannelAdapterSpec} inheritor type
127119 * @return the {@link JmsInboundChannelAdapterSpec} instance
128120 */
129- public static <S extends JmsInboundChannelAdapterSpec <S >> JmsInboundChannelAdapterSpec <S > inboundAdapter (
130- JmsTemplate jmsTemplate ) {
131- return new JmsInboundChannelAdapterSpec <S >(jmsTemplate );
121+ public static JmsInboundChannelAdapterSpec <?> inboundAdapter (JmsTemplate jmsTemplate ) {
122+ return new JmsInboundChannelAdapterSpec <>(jmsTemplate );
132123 }
133124
134125 /**
@@ -138,6 +129,7 @@ public static <S extends JmsInboundChannelAdapterSpec<S>> JmsInboundChannelAdapt
138129 */
139130 public static JmsInboundChannelAdapterSpec .JmsInboundChannelSpecTemplateAware inboundAdapter (
140131 ConnectionFactory connectionFactory ) {
132+
141133 return new JmsInboundChannelAdapterSpec .JmsInboundChannelSpecTemplateAware (connectionFactory );
142134 }
143135
@@ -153,12 +145,10 @@ public static JmsOutboundGatewaySpec outboundGateway(ConnectionFactory connectio
153145 /**
154146 * The factory to produce a {@link JmsOutboundGatewaySpec}.
155147 * @param listenerContainer the JMS {@link AbstractMessageListenerContainer} to build on
156- * @param <S> the {@link JmsInboundGatewaySpec} inheritor type
157148 * @return the {@link JmsOutboundGatewaySpec} instance
158149 */
159- public static <S extends JmsInboundGatewaySpec <S >> JmsInboundGatewaySpec <S > inboundGateway (
160- AbstractMessageListenerContainer listenerContainer ) {
161- return new JmsInboundGatewaySpec <S >(listenerContainer );
150+ public static JmsInboundGatewaySpec <?> inboundGateway (AbstractMessageListenerContainer listenerContainer ) {
151+ return new JmsInboundGatewaySpec <>(listenerContainer );
162152 }
163153
164154 /**
@@ -168,26 +158,35 @@ public static <S extends JmsInboundGatewaySpec<S>> JmsInboundGatewaySpec<S> inbo
168158 */
169159 public static JmsInboundGatewaySpec .JmsInboundGatewayListenerContainerSpec <JmsDefaultListenerContainerSpec , DefaultMessageListenerContainer >
170160 inboundGateway (ConnectionFactory connectionFactory ) {
171- return inboundGateway (connectionFactory , DefaultMessageListenerContainer .class );
161+
162+ try {
163+ return new JmsInboundGatewaySpec .JmsInboundGatewayListenerContainerSpec <>(
164+ new JmsDefaultListenerContainerSpec ()
165+ .connectionFactory (connectionFactory ));
166+ }
167+ catch (Exception e ) {
168+ throw new IllegalStateException (e );
169+ }
172170 }
173171
174172 /**
175173 * The factory to produce a {@link JmsOutboundGatewaySpec}.
176174 * @param connectionFactory the JMS ConnectionFactory to build on
177175 * @param containerClass the {@link AbstractMessageListenerContainer} implementation class
178176 * to instantiate listener container
179- * @param <S> the {@link JmsListenerContainerSpec} inheritor type
180177 * @param <C> the {@link AbstractMessageListenerContainer} inheritor type
181178 * @return the {@link JmsOutboundGatewaySpec} instance
182179 */
183- public static <S extends JmsListenerContainerSpec <S , C >, C extends AbstractMessageListenerContainer >
184- JmsInboundGatewaySpec .JmsInboundGatewayListenerContainerSpec <S , C > inboundGateway (ConnectionFactory connectionFactory ,
185- Class <C > containerClass ) {
180+ @ SuppressWarnings ({ "rawtypes" , "unchecked" })
181+ public static <C extends AbstractMessageListenerContainer >
182+ JmsInboundGatewaySpec .JmsInboundGatewayListenerContainerSpec <?, C > inboundGateway (
183+ ConnectionFactory connectionFactory , Class <C > containerClass ) {
184+
186185 try {
187- JmsListenerContainerSpec <S , C > spec =
188- new JmsListenerContainerSpec <S , C >(containerClass )
186+ JmsListenerContainerSpec <? , C > spec =
187+ new JmsListenerContainerSpec <>(containerClass )
189188 .connectionFactory (connectionFactory );
190- return new JmsInboundGatewaySpec .JmsInboundGatewayListenerContainerSpec < S , C > (spec );
189+ return new JmsInboundGatewaySpec .JmsInboundGatewayListenerContainerSpec (spec );
191190 }
192191 catch (Exception e ) {
193192 throw new IllegalStateException (e );
@@ -197,13 +196,10 @@ JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<S, C> inboundGatewa
197196 /**
198197 * The factory to produce a {@link JmsMessageDrivenChannelAdapterSpec}.
199198 * @param listenerContainer the {@link AbstractMessageListenerContainer} to build on
200- * @param <S> the {@link JmsMessageDrivenChannelAdapterSpec} inheritor type
201199 * @return the {@link JmsMessageDrivenChannelAdapterSpec} instance
202200 */
203- public static <S extends JmsMessageDrivenChannelAdapterSpec <S >>
204- JmsMessageDrivenChannelAdapterSpec <S > messageDrivenChannelAdapter (
205- AbstractMessageListenerContainer listenerContainer ) {
206- return new JmsMessageDrivenChannelAdapterSpec <S >(listenerContainer );
201+ public static JmsMessageDrivenChannelAdapterSpec <?> messageDrivenChannelAdapter (AbstractMessageListenerContainer listenerContainer ) {
202+ return new JmsMessageDrivenChannelAdapterSpec <>(listenerContainer );
207203 }
208204
209205 /**
@@ -215,7 +211,8 @@ JmsMessageDrivenChannelAdapterSpec<S> messageDrivenChannelAdapter(
215211 messageDrivenChannelAdapter (ConnectionFactory connectionFactory ) {
216212 try {
217213 return new JmsMessageDrivenChannelAdapterSpec .JmsMessageDrivenChannelAdapterListenerContainerSpec <>(
218- new JmsDefaultListenerContainerSpec ().connectionFactory (connectionFactory ));
214+ new JmsDefaultListenerContainerSpec ()
215+ .connectionFactory (connectionFactory ));
219216 }
220217 catch (Exception e ) {
221218 throw new IllegalStateException (e );
@@ -227,18 +224,18 @@ JmsMessageDrivenChannelAdapterSpec<S> messageDrivenChannelAdapter(
227224 * @param connectionFactory the JMS ConnectionFactory to build on
228225 * @param containerClass the {@link AbstractMessageListenerContainer} implementation class
229226 * to instantiate listener container
230- * @param <S> the {@link JmsListenerContainerSpec} inheritor type
231227 * @param <C> the {@link AbstractMessageListenerContainer} inheritor type
232228 * @return the {@link JmsMessageDrivenChannelAdapterSpec} instance
233229 */
234- public static <S extends JmsListenerContainerSpec <S , C >, C extends AbstractMessageListenerContainer >
235- JmsMessageDrivenChannelAdapterSpec .JmsMessageDrivenChannelAdapterListenerContainerSpec <S , C >
230+ @ SuppressWarnings ({ "rawtypes" , "unchecked" })
231+ public static <C extends AbstractMessageListenerContainer >
232+ JmsMessageDrivenChannelAdapterSpec .JmsMessageDrivenChannelAdapterListenerContainerSpec <?, C >
236233 messageDrivenChannelAdapter (ConnectionFactory connectionFactory , Class <C > containerClass ) {
237234 try {
238- S spec =
239- new JmsListenerContainerSpec <S , C >(containerClass )
235+ JmsListenerContainerSpec <?, C > spec =
236+ new JmsListenerContainerSpec <>(containerClass )
240237 .connectionFactory (connectionFactory );
241- return new JmsMessageDrivenChannelAdapterSpec .JmsMessageDrivenChannelAdapterListenerContainerSpec <> (spec );
238+ return new JmsMessageDrivenChannelAdapterSpec .JmsMessageDrivenChannelAdapterListenerContainerSpec (spec );
242239 }
243240 catch (Exception e ) {
244241 throw new IllegalStateException (e );
0 commit comments