Browse Source

Consistent nullability of headers Map and MessagePostProcessor

Issue: SPR-15670
pull/1460/head
Juergen Hoeller 9 years ago
parent
commit
7e251274ee
  1. 21
      spring-messaging/src/main/java/org/springframework/messaging/core/AbstractDestinationResolvingMessagingTemplate.java
  2. 8
      spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessagingTemplate.java
  3. 14
      spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageRequestReplyOperations.java
  4. 6
      spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageSendingOperations.java
  5. 13
      spring-messaging/src/main/java/org/springframework/messaging/core/MessageRequestReplyOperations.java

21
spring-messaging/src/main/java/org/springframework/messaging/core/AbstractDestinationResolvingMessagingTemplate.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2017 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.
@ -80,17 +80,19 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A @@ -80,17 +80,19 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
}
@Override
public <T> void convertAndSend(String destinationName, T payload, Map<String, Object> headers) {
public <T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers) {
convertAndSend(destinationName, payload, headers, null);
}
@Override
public <T> void convertAndSend(String destinationName, T payload, MessagePostProcessor postProcessor) {
public <T> void convertAndSend(String destinationName, T payload, @Nullable MessagePostProcessor postProcessor) {
convertAndSend(destinationName, payload, null, postProcessor);
}
@Override
public <T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers, @Nullable MessagePostProcessor postProcessor) {
public <T> void convertAndSend(String destinationName, T payload,
@Nullable Map<String, Object> headers, @Nullable MessagePostProcessor postProcessor) {
D destination = resolveDestination(destinationName);
super.convertAndSend(destination, payload, headers, postProcessor);
}
@ -120,8 +122,8 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A @@ -120,8 +122,8 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
}
@Override
public <T> T convertSendAndReceive(String destinationName, Object request, Map<String, Object> headers,
Class<T> targetClass) {
public <T> T convertSendAndReceive(String destinationName, Object request,
@Nullable Map<String, Object> headers, Class<T> targetClass) {
D destination = resolveDestination(destinationName);
return super.convertSendAndReceive(destination, request, headers, targetClass);
@ -129,15 +131,16 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A @@ -129,15 +131,16 @@ public abstract class AbstractDestinationResolvingMessagingTemplate<D> extends A
@Override
public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass,
MessagePostProcessor postProcessor) {
@Nullable MessagePostProcessor postProcessor) {
D destination = resolveDestination(destinationName);
return super.convertSendAndReceive(destination, request, targetClass, postProcessor);
}
@Override
public <T> T convertSendAndReceive(String destinationName, Object request, Map<String, Object> headers,
Class<T> targetClass, MessagePostProcessor postProcessor) {
public <T> T convertSendAndReceive(String destinationName, Object request,
@Nullable Map<String, Object> headers, Class<T> targetClass,
@Nullable MessagePostProcessor postProcessor) {
D destination = resolveDestination(destinationName);
return super.convertSendAndReceive(destination, request, headers, targetClass, postProcessor);

8
spring-messaging/src/main/java/org/springframework/messaging/core/AbstractMessagingTemplate.java

@ -58,12 +58,16 @@ public abstract class AbstractMessagingTemplate<D> extends AbstractMessageReceiv @@ -58,12 +58,16 @@ public abstract class AbstractMessagingTemplate<D> extends AbstractMessageReceiv
}
@Override
public <T> T convertSendAndReceive(D destination, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass) {
public <T> T convertSendAndReceive(
D destination, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass) {
return convertSendAndReceive(destination, request, headers, targetClass, null);
}
@Override
public <T> T convertSendAndReceive(Object request, Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) {
public <T> T convertSendAndReceive(
Object request, Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) {
return convertSendAndReceive(getRequiredDefaultDestination(), request, targetClass, postProcessor);
}

14
spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageRequestReplyOperations.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@ -74,8 +74,8 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me @@ -74,8 +74,8 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me
* the message could not be received, for example due to a timeout
*/
@Nullable
<T> T convertSendAndReceive(String destinationName, Object request, Map<String, Object> headers,
Class<T> targetClass) throws MessagingException;
<T> T convertSendAndReceive(String destinationName, Object request,
@Nullable Map<String, Object> headers, Class<T> targetClass) throws MessagingException;
/**
* Resolve the given destination name, convert the payload request Object
@ -92,8 +92,8 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me @@ -92,8 +92,8 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me
* the message could not be received, for example due to a timeout
*/
@Nullable
<T> T convertSendAndReceive(String destinationName, Object request,
Class<T> targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException;
<T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass,
@Nullable MessagePostProcessor requestPostProcessor) throws MessagingException;
/**
* Resolve the given destination name, convert the payload request Object
@ -111,7 +111,7 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me @@ -111,7 +111,7 @@ public interface DestinationResolvingMessageRequestReplyOperations<D> extends Me
* the message could not be received, for example due to a timeout
*/
@Nullable
<T> T convertSendAndReceive(String destinationName, Object request, Map<String, Object> headers,
Class<T> targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException;
<T> T convertSendAndReceive(String destinationName, Object request, @Nullable Map<String, Object> headers,
Class<T> targetClass, @Nullable MessagePostProcessor requestPostProcessor) throws MessagingException;
}

6
spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolvingMessageSendingOperations.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2017 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.
@ -60,7 +60,7 @@ public interface DestinationResolvingMessageSendingOperations<D> extends Message @@ -60,7 +60,7 @@ public interface DestinationResolvingMessageSendingOperations<D> extends Message
* @param payload the Object to use as payload
* @param headers headers for the message to send
*/
<T> void convertAndSend(String destinationName, T payload, Map<String, Object> headers)
<T> void convertAndSend(String destinationName, T payload, @Nullable Map<String, Object> headers)
throws MessagingException;
/**
@ -73,7 +73,7 @@ public interface DestinationResolvingMessageSendingOperations<D> extends Message @@ -73,7 +73,7 @@ public interface DestinationResolvingMessageSendingOperations<D> extends Message
* @param payload the Object to use as payload
* @param postProcessor the post processor to apply to the message
*/
<T> void convertAndSend(String destinationName, T payload, MessagePostProcessor postProcessor)
<T> void convertAndSend(String destinationName, T payload, @Nullable MessagePostProcessor postProcessor)
throws MessagingException;
/**

13
spring-messaging/src/main/java/org/springframework/messaging/core/MessageRequestReplyOperations.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@ -92,7 +92,8 @@ public interface MessageRequestReplyOperations<D> { @@ -92,7 +92,8 @@ public interface MessageRequestReplyOperations<D> {
* could not be received, for example due to a timeout
*/
@Nullable
<T> T convertSendAndReceive(D destination, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass)
<T> T convertSendAndReceive(
D destination, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass)
throws MessagingException;
/**
@ -108,7 +109,8 @@ public interface MessageRequestReplyOperations<D> { @@ -108,7 +109,8 @@ public interface MessageRequestReplyOperations<D> {
* could not be received, for example due to a timeout
*/
@Nullable
<T> T convertSendAndReceive(Object request, Class<T> targetClass, @Nullable MessagePostProcessor requestPostProcessor)
<T> T convertSendAndReceive(
Object request, Class<T> targetClass, @Nullable MessagePostProcessor requestPostProcessor)
throws MessagingException;
/**
@ -142,7 +144,8 @@ public interface MessageRequestReplyOperations<D> { @@ -142,7 +144,8 @@ public interface MessageRequestReplyOperations<D> {
* could not be received, for example due to a timeout
*/
@Nullable
<T> T convertSendAndReceive(D destination, Object request, @Nullable Map<String, Object> headers,
Class<T> targetClass, @Nullable MessagePostProcessor requestPostProcessor) throws MessagingException;
<T> T convertSendAndReceive(
D destination, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass,
@Nullable MessagePostProcessor requestPostProcessor) throws MessagingException;
}

Loading…
Cancel
Save