Skip to content

Commit 4c0dff4

Browse files
Polish diamond operator and pattern matching usage
1 parent ee578d8 commit 4c0dff4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

spring-amqp/src/main/java/org/springframework/amqp/core/BindingBuilder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ public static final class TopicExchangeRoutingKeyConfigurer extends AbstractRout
231231

232232
public Binding with(String routingKey) {
233233
return new Binding(destination.queue, destination.name, destination.type, exchange, routingKey,
234-
Collections.<String, Object>emptyMap());
234+
Collections.emptyMap());
235235
}
236236

237237
public Binding with(Enum<?> routingKeyEnum) {
238238
return new Binding(destination.queue, destination.name, destination.type, exchange,
239-
routingKeyEnum.toString(), Collections.<String, Object>emptyMap());
239+
routingKeyEnum.toString(), Collections.emptyMap());
240240
}
241241
}
242242

@@ -282,7 +282,7 @@ public Binding and(Map<String, Object> map) {
282282
public Binding noargs() {
283283
return new Binding(this.configurer.destination.queue,
284284
this.configurer.destination.name, this.configurer.destination.type, this.configurer.exchange,
285-
this.routingKey, Collections.<String, Object>emptyMap());
285+
this.routingKey, Collections.emptyMap());
286286
}
287287

288288
}
@@ -298,17 +298,17 @@ public static final class DirectExchangeRoutingKeyConfigurer extends AbstractRou
298298

299299
public Binding with(String routingKey) {
300300
return new Binding(destination.queue, destination.name, destination.type, exchange, routingKey,
301-
Collections.<String, Object>emptyMap());
301+
Collections.emptyMap());
302302
}
303303

304304
public Binding with(Enum<?> routingKeyEnum) {
305305
return new Binding(destination.queue, destination.name, destination.type, exchange,
306-
routingKeyEnum.toString(), Collections.<String, Object>emptyMap());
306+
routingKeyEnum.toString(), Collections.emptyMap());
307307
}
308308

309309
public Binding withQueueName() {
310310
return new Binding(destination.queue, destination.name, destination.type, exchange, destination.name,
311-
Collections.<String, Object>emptyMap());
311+
Collections.emptyMap());
312312
}
313313

314314
}

spring-amqp/src/main/java/org/springframework/amqp/support/converter/MessagingMessageConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2024 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.
@@ -40,6 +40,7 @@
4040
* is considered to be a request).
4141
*
4242
* @author Stephane Nicoll
43+
* @author Ngoc Nhan
4344
* @since 1.4
4445
*/
4546
public class MessagingMessageConverter implements MessageConverter, InitializingBean {
@@ -104,11 +105,10 @@ public void afterPropertiesSet() {
104105
public org.springframework.amqp.core.Message toMessage(Object object, MessageProperties messageProperties)
105106
throws MessageConversionException {
106107

107-
if (!(object instanceof Message)) {
108+
if (!(object instanceof Message<?> input)) {
108109
throw new IllegalArgumentException("Could not convert [" + object + "] - only [" +
109110
Message.class.getName() + "] is handled by this converter");
110111
}
111-
Message<?> input = (Message<?>) object;
112112
this.headerMapper.fromHeaders(input.getHeaders(), messageProperties);
113113
org.springframework.amqp.core.Message amqpMessage = this.payloadConverter.toMessage(
114114
input.getPayload(), messageProperties);

0 commit comments

Comments
 (0)