@@ -54,20 +54,20 @@ public class UseTlsAmqpConnectionString extends Recipe {
5454 @ Nullable
5555 String propertyKey ;
5656
57- @ Option (displayName = "Old Port " ,
57+ @ Option (displayName = "Old port " ,
5858 description = "The non-TLS enabled port number to replace with the TLS-enabled port. " +
5959 "If this value is specified, no changes will be made to amqp connection strings which do not contain this port number. " ,
6060 example = "1234" )
6161 @ Nullable
6262 Integer oldPort ;
6363
64- @ Option (displayName = "TLS Port " ,
64+ @ Option (displayName = "TLS port " ,
6565 description = "The TLS-enabled port to use." ,
6666 example = "1234" )
6767 @ Nullable
6868 Integer port ;
6969
70- @ Option (displayName = "TLS Property Key " ,
70+ @ Option (displayName = "TLS property key " ,
7171 description = "The Spring property key to enable default TLS mode against. " +
7272 "If this value is specified, the specified property will be used when updating the default TLS mode, otherwise a default of " +
7373 "`spring.rabbitmq.ssl.enabled` will be used instead." ,
@@ -139,7 +139,7 @@ private boolean sourcePathMatches(Path sourcePath, ExecutionContext ctx) {
139139
140140 @ EqualsAndHashCode (callSuper = false )
141141 @ Value
142- static class UseTlsAmqpConnectionStringYaml extends Recipe {
142+ static class UseTlsAmqpConnectionStringYaml {
143143 String propertyKey ;
144144
145145 @ Nullable
@@ -153,17 +153,6 @@ static class UseTlsAmqpConnectionStringYaml extends Recipe {
153153 @ Nullable
154154 List <String > pathExpressions ;
155155
156- @ Override
157- public String getDisplayName () {
158- return "Use TLS for AMQP connection strings" ;
159- }
160-
161- @ Override
162- public String getDescription () {
163- return "Use TLS for AMQP connection strings." ;
164- }
165-
166- @ Override
167156 public TreeVisitor <?, ExecutionContext > getVisitor () {
168157 return Preconditions .check (new YamlVisitor <ExecutionContext >() {
169158 @ Override
@@ -225,7 +214,7 @@ public Yaml.Mapping.Entry visitMappingEntry(Yaml.Mapping.Entry entry, ExecutionC
225214 }
226215
227216 if (updated ) {
228- e = e .withValue (((Yaml .Scalar ) e .getValue ()).withValue (join (connectionStrings , "," )));
217+ e = e .withValue (((Yaml .Scalar ) e .getValue ()).withValue (String . join ("," , connectionStrings )));
229218 }
230219 } catch (URISyntaxException | IllegalArgumentException ignored ) {
231220 // do nothing
@@ -239,7 +228,7 @@ public Yaml.Mapping.Entry visitMappingEntry(Yaml.Mapping.Entry entry, ExecutionC
239228
240229 @ EqualsAndHashCode (callSuper = false )
241230 @ Value
242- static class UseTlsAmqpConnectionStringProperties extends Recipe {
231+ static class UseTlsAmqpConnectionStringProperties {
243232 String propertyKey ;
244233
245234 @ Nullable
@@ -253,17 +242,6 @@ static class UseTlsAmqpConnectionStringProperties extends Recipe {
253242 @ Nullable
254243 List <String > pathExpressions ;
255244
256- @ Override
257- public String getDisplayName () {
258- return "Use TLS for AMQP connection strings" ;
259- }
260-
261- @ Override
262- public String getDescription () {
263- return "Use TLS for AMQP connection strings." ;
264- }
265-
266- @ Override
267245 public TreeVisitor <?, ExecutionContext > getVisitor () {
268246 return Preconditions .check (new PropertiesVisitor <ExecutionContext >() {
269247 @ Override
@@ -323,7 +301,7 @@ public Properties.Entry visitEntry(Properties.Entry entry, ExecutionContext ctx)
323301 }
324302
325303 if (updated ) {
326- e = e .withValue (e .getValue ().withText (join (connectionStrings , "," )));
304+ e = e .withValue (e .getValue ().withText (String . join ("," , connectionStrings )));
327305 }
328306 } catch (URISyntaxException | IllegalArgumentException ignored ) {
329307 // do nothing
@@ -354,17 +332,4 @@ private static String maybeUpdateAmqpConnectionString(String amqpUrl, @Nullable
354332 }
355333 return updatedAmqpUrl ;
356334 }
357-
358- private static String join (String [] strings , String separator ) {
359- if (strings .length == 0 ) {
360- return "" ;
361- }
362-
363- StringBuilder builder = new StringBuilder ();
364- int idx = 0 ;
365- while (idx < strings .length - 1 ) {
366- builder .append (strings [idx ++]).append (separator );
367- }
368- return builder .append (strings [idx ]).toString ();
369- }
370335}
0 commit comments