Skip to content

Commit fc37712

Browse files
authoredSep 23, 2024
Modernize code for diamond, isEmpty & pattern matching
1 parent 40faaa0 commit fc37712

File tree

107 files changed

+550
-454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+550
-454
lines changed
 

Diff for: ‎spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/AbstractAmqpChannel.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-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.
@@ -45,6 +45,7 @@
4545
* @author Mark Fisher
4646
* @author Artem Bilan
4747
* @author Gary Russell
48+
* @author Ngoc Nhan
4849
*
4950
* @since 2.1
5051
*/
@@ -94,8 +95,8 @@ public abstract class AbstractAmqpChannel extends AbstractMessageChannel impleme
9495
AbstractAmqpChannel(AmqpTemplate amqpTemplate, AmqpHeaderMapper outboundMapper, AmqpHeaderMapper inboundMapper) {
9596
Assert.notNull(amqpTemplate, "amqpTemplate must not be null");
9697
this.amqpTemplate = amqpTemplate;
97-
if (amqpTemplate instanceof RabbitTemplate) {
98-
this.rabbitTemplate = (RabbitTemplate) amqpTemplate;
98+
if (amqpTemplate instanceof RabbitTemplate castRabbitTemplate) {
99+
this.rabbitTemplate = castRabbitTemplate;
99100
MessageConverter converter = this.rabbitTemplate.getMessageConverter();
100101
if (converter instanceof AllowedListDeserializingMessageConverter allowedListMessageConverter) {
101102
allowedListMessageConverter.addAllowedListPatterns(

Diff for: ‎spring-integration-amqp/src/main/java/org/springframework/integration/amqp/channel/PollableAmqpChannel.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
* @author Mark Fisher
4848
* @author Artem Bilan
4949
* @author Gary Russell
50+
* @author Ngoc Nhan
5051
*
5152
* @since 2.1
5253
*/
@@ -167,7 +168,7 @@ protected Message<?> doReceive(Long timeout) {
167168
if (traceEnabled) {
168169
logger.trace("preReceive on channel '" + this + "'");
169170
}
170-
if (interceptorList.getInterceptors().size() > 0) {
171+
if (!interceptorList.getInterceptors().isEmpty()) {
171172
interceptorStack = new ArrayDeque<>();
172173
if (!interceptorList.preReceive(this, interceptorStack)) {
173174
return null;

0 commit comments

Comments
 (0)