Skip to content

Commit 9db48fc

Browse files
authored
GH-3813: add missing nullability annotations to KafkaOperations (#3837)
Fixes: #3813 Issue link: #3813 **Auto-cherry-pick to `3.3.x`** Signed-off-by: Giacomo Baso <[email protected]> Co-authored-by: Giacomo Baso <[email protected]>
1 parent 9f598c8 commit 9db48fc

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

spring-kafka/src/main/java/org/springframework/kafka/core/KafkaOperations.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
* @author Marius Bogoevici
5656
* @author Gary Russell
5757
* @author Biju Kunjummen
58+
* @author Giacomo Baso
5859
*/
5960
public interface KafkaOperations<K, V> {
6061

@@ -68,15 +69,15 @@ public interface KafkaOperations<K, V> {
6869
* @param data The data.
6970
* @return a Future for the {@link SendResult}.
7071
*/
71-
CompletableFuture<SendResult<K, V>> sendDefault(V data);
72+
CompletableFuture<SendResult<K, V>> sendDefault(@Nullable V data);
7273

7374
/**
7475
* Send the data to the default topic with the provided key and no partition.
7576
* @param key the key.
7677
* @param data The data.
7778
* @return a Future for the {@link SendResult}.
7879
*/
79-
CompletableFuture<SendResult<K, V>> sendDefault(K key, V data);
80+
CompletableFuture<SendResult<K, V>> sendDefault(K key, @Nullable V data);
8081

8182
/**
8283
* Send the data to the default topic with the provided key and partition.
@@ -85,7 +86,7 @@ public interface KafkaOperations<K, V> {
8586
* @param data the data.
8687
* @return a Future for the {@link SendResult}.
8788
*/
88-
CompletableFuture<SendResult<K, V>> sendDefault(Integer partition, K key, V data);
89+
CompletableFuture<SendResult<K, V>> sendDefault(Integer partition, K key, @Nullable V data);
8990

9091
/**
9192
* Send the data to the default topic with the provided key and partition.
@@ -96,15 +97,15 @@ public interface KafkaOperations<K, V> {
9697
* @return a Future for the {@link SendResult}.
9798
* @since 1.3
9899
*/
99-
CompletableFuture<SendResult<K, V>> sendDefault(Integer partition, Long timestamp, K key, V data);
100+
CompletableFuture<SendResult<K, V>> sendDefault(Integer partition, Long timestamp, K key, @Nullable V data);
100101

101102
/**
102103
* Send the data to the provided topic with no key or partition.
103104
* @param topic the topic.
104105
* @param data The data.
105106
* @return a Future for the {@link SendResult}.
106107
*/
107-
CompletableFuture<SendResult<K, V>> send(String topic, V data);
108+
CompletableFuture<SendResult<K, V>> send(String topic, @Nullable V data);
108109

109110
/**
110111
* Send the data to the provided topic with the provided key and no partition.
@@ -113,7 +114,7 @@ public interface KafkaOperations<K, V> {
113114
* @param data The data.
114115
* @return a Future for the {@link SendResult}.
115116
*/
116-
CompletableFuture<SendResult<K, V>> send(String topic, K key, V data);
117+
CompletableFuture<SendResult<K, V>> send(String topic, K key, @Nullable V data);
117118

118119
/**
119120
* Send the data to the provided topic with the provided key and partition.
@@ -123,7 +124,7 @@ public interface KafkaOperations<K, V> {
123124
* @param data the data.
124125
* @return a Future for the {@link SendResult}.
125126
*/
126-
CompletableFuture<SendResult<K, V>> send(String topic, Integer partition, K key, V data);
127+
CompletableFuture<SendResult<K, V>> send(String topic, Integer partition, K key, @Nullable V data);
127128

128129
/**
129130
* Send the data to the provided topic with the provided key and partition.
@@ -135,7 +136,7 @@ public interface KafkaOperations<K, V> {
135136
* @return a Future for the {@link SendResult}.
136137
* @since 1.3
137138
*/
138-
CompletableFuture<SendResult<K, V>> send(String topic, Integer partition, Long timestamp, K key, V data);
139+
CompletableFuture<SendResult<K, V>> send(String topic, Integer partition, Long timestamp, K key, @Nullable V data);
139140

140141
/**
141142
* Send the provided {@link ProducerRecord}.

0 commit comments

Comments
 (0)