Annotate EventBus body parameters with Nullable - see #3199

This commit is contained in:
Julien Viet
2019-11-17 11:34:14 +01:00
parent 8370289db2
commit 7fc8a7a93a
2 changed files with 15 additions and 14 deletions

View File

@@ -13,6 +13,7 @@ package io.vertx.core.eventbus;
import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.Nullable;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
@@ -44,7 +45,7 @@ public interface EventBus extends Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
EventBus send(String address, Object message);
EventBus send(String address, @Nullable Object message);
/**
* Like {@link #send(String, Object)} but specifying {@code options} that can be used to configure the delivery.
@@ -55,7 +56,7 @@ public interface EventBus extends Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
EventBus send(String address, Object message, DeliveryOptions options);
EventBus send(String address, @Nullable Object message, DeliveryOptions options);
/**
* Sends a message and and specify a {@code replyHandler} that will be called if the recipient
@@ -69,14 +70,14 @@ public interface EventBus extends Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
default <T> EventBus request(String address, Object message, Handler<AsyncResult<Message<T>>> replyHandler) {
default <T> EventBus request(String address, @Nullable Object message, Handler<AsyncResult<Message<T>>> replyHandler) {
return request(address, message, new DeliveryOptions(), replyHandler);
}
/**
* Like {@link #request(String, Object, Handler)} but returns a {@code Future} of the asynchronous result
*/
default <T> Future<Message<T>> request(String address, Object message) {
default <T> Future<Message<T>> request(String address, @Nullable Object message) {
return request(address, message, new DeliveryOptions());
}
@@ -90,7 +91,7 @@ public interface EventBus extends Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
default <T> EventBus request(String address, Object message, DeliveryOptions options, Handler<AsyncResult<Message<T>>> replyHandler) {
default <T> EventBus request(String address, @Nullable Object message, DeliveryOptions options, Handler<AsyncResult<Message<T>>> replyHandler) {
Future<Message<T>> reply = request(address, message, options);
reply.setHandler(replyHandler);
return this;
@@ -99,7 +100,7 @@ public interface EventBus extends Measured {
/**
* Like {@link #request(String, Object, DeliveryOptions, Handler)} but returns a {@code Future} of the asynchronous result
*/
<T> Future<Message<T>> request(String address, Object message, DeliveryOptions options);
<T> Future<Message<T>> request(String address, @Nullable Object message, DeliveryOptions options);
/**
* Publish a message.<p>
@@ -111,7 +112,7 @@ public interface EventBus extends Measured {
*
*/
@Fluent
EventBus publish(String address, Object message);
EventBus publish(String address, @Nullable Object message);
/**
* Like {@link #publish(String, Object)} but specifying {@code options} that can be used to configure the delivery.
@@ -122,7 +123,7 @@ public interface EventBus extends Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
EventBus publish(String address, Object message, DeliveryOptions options);
EventBus publish(String address, @Nullable Object message, DeliveryOptions options);
/**
* Create a message consumer against the specified address.

View File

@@ -77,7 +77,7 @@ public interface Message<T> {
*
* @param message the message to reply with.
*/
default void reply(Object message) {
default void reply(@Nullable Object message) {
reply(message, new DeliveryOptions());
}
@@ -87,7 +87,7 @@ public interface Message<T> {
* @param message the reply message
* @param options the delivery options
*/
void reply(Object message, DeliveryOptions options);
void reply(@Nullable Object message, DeliveryOptions options);
/**
* Reply to this message, specifying a {@code replyHandler} for the reply - i.e.
@@ -100,14 +100,14 @@ public interface Message<T> {
* @param message the message to reply with.
* @param replyHandler the reply handler for the reply.
*/
default <R> void replyAndRequest(Object message, Handler<AsyncResult<Message<R>>> replyHandler) {
default <R> void replyAndRequest(@Nullable Object message, Handler<AsyncResult<Message<R>>> replyHandler) {
replyAndRequest(message, new DeliveryOptions(), replyHandler);
}
/**
* Like {@link #replyAndRequest(Object, Handler)} but returns a {@code Future} of the asynchronous result
*/
default <R> Future<Message<R>> replyAndRequest(Object message) {
default <R> Future<Message<R>> replyAndRequest(@Nullable Object message) {
return replyAndRequest(message, new DeliveryOptions());
}
@@ -119,14 +119,14 @@ public interface Message<T> {
* @param options delivery options
* @param replyHandler reply handler will be called when any reply from the recipient is received
*/
default <R> void replyAndRequest(Object message, DeliveryOptions options, Handler<AsyncResult<Message<R>>> replyHandler) {
default <R> void replyAndRequest(@Nullable Object message, DeliveryOptions options, Handler<AsyncResult<Message<R>>> replyHandler) {
this.<R>replyAndRequest(message, options).setHandler(replyHandler);
}
/**
* Like {@link #replyAndRequest(Object, DeliveryOptions, Handler)} but returns a {@code Future} of the asynchronous result
*/
<R> Future<Message<R>> replyAndRequest(Object message, DeliveryOptions options);
<R> Future<Message<R>> replyAndRequest(@Nullable Object message, DeliveryOptions options);
/**
* Signal to the sender that processing of this message failed.