Use new Java features (switch expressions, text blocks, new JDK methods)
Closes gh-29747
This commit is contained in:
committed by
Sam Brannen
parent
48abd493fe
commit
afb8a0d1b1
@@ -378,10 +378,9 @@ public abstract class AbstractMethodMessageHandler<T>
|
||||
*/
|
||||
protected HandlerMethod createHandlerMethod(Object handler, Method method) {
|
||||
HandlerMethod handlerMethod;
|
||||
if (handler instanceof String) {
|
||||
if (handler instanceof String beanName) {
|
||||
ApplicationContext context = getApplicationContext();
|
||||
Assert.state(context != null, "ApplicationContext is required for resolving handler bean names");
|
||||
String beanName = (String) handler;
|
||||
handlerMethod = new HandlerMethod(beanName, context.getAutowireCapableBeanFactory(), method);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -93,10 +93,9 @@ public class GenericMessage<T> implements Message<T>, Serializable {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof GenericMessage)) {
|
||||
if (!(other instanceof GenericMessage<?> otherMsg)) {
|
||||
return false;
|
||||
}
|
||||
GenericMessage<?> otherMsg = (GenericMessage<?>) other;
|
||||
// Using nullSafeEquals for proper array equals comparisons
|
||||
return (ObjectUtils.nullSafeEquals(this.payload, otherMsg.payload) && this.headers.equals(otherMsg.headers));
|
||||
}
|
||||
|
||||
@@ -617,8 +617,7 @@ public class MessageHeaderAccessor {
|
||||
* @since 4.1
|
||||
*/
|
||||
public static MessageHeaderAccessor getMutableAccessor(Message<?> message) {
|
||||
if (message.getHeaders() instanceof MutableMessageHeaders) {
|
||||
MutableMessageHeaders mutableHeaders = (MutableMessageHeaders) message.getHeaders();
|
||||
if (message.getHeaders() instanceof MutableMessageHeaders mutableHeaders) {
|
||||
MessageHeaderAccessor accessor = mutableHeaders.getAccessor();
|
||||
return (accessor.isMutable() ? accessor : accessor.createAccessor(message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user