Skip to content

Commit

Permalink
Polish diamond operator and pattern matching usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocnhan-tran1996 committed Oct 15, 2024
1 parent ee578d8 commit 4c0dff4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ public static final class TopicExchangeRoutingKeyConfigurer extends AbstractRout

public Binding with(String routingKey) {
return new Binding(destination.queue, destination.name, destination.type, exchange, routingKey,
Collections.<String, Object>emptyMap());
Collections.emptyMap());
}

public Binding with(Enum<?> routingKeyEnum) {
return new Binding(destination.queue, destination.name, destination.type, exchange,
routingKeyEnum.toString(), Collections.<String, Object>emptyMap());
routingKeyEnum.toString(), Collections.emptyMap());
}
}

Expand Down Expand Up @@ -282,7 +282,7 @@ public Binding and(Map<String, Object> map) {
public Binding noargs() {
return new Binding(this.configurer.destination.queue,
this.configurer.destination.name, this.configurer.destination.type, this.configurer.exchange,
this.routingKey, Collections.<String, Object>emptyMap());
this.routingKey, Collections.emptyMap());
}

}
Expand All @@ -298,17 +298,17 @@ public static final class DirectExchangeRoutingKeyConfigurer extends AbstractRou

public Binding with(String routingKey) {
return new Binding(destination.queue, destination.name, destination.type, exchange, routingKey,
Collections.<String, Object>emptyMap());
Collections.emptyMap());
}

public Binding with(Enum<?> routingKeyEnum) {
return new Binding(destination.queue, destination.name, destination.type, exchange,
routingKeyEnum.toString(), Collections.<String, Object>emptyMap());
routingKeyEnum.toString(), Collections.emptyMap());
}

public Binding withQueueName() {
return new Binding(destination.queue, destination.name, destination.type, exchange, destination.name,
Collections.<String, Object>emptyMap());
Collections.emptyMap());
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2020 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,6 +40,7 @@
* is considered to be a request).
*
* @author Stephane Nicoll
* @author Ngoc Nhan
* @since 1.4
*/
public class MessagingMessageConverter implements MessageConverter, InitializingBean {
Expand Down Expand Up @@ -104,11 +105,10 @@ public void afterPropertiesSet() {
public org.springframework.amqp.core.Message toMessage(Object object, MessageProperties messageProperties)
throws MessageConversionException {

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

0 comments on commit 4c0dff4

Please sign in to comment.