Skip to content

Commit cf70523

Browse files
committed
Unified addSubscriptions/addTopicFilters/addAll signatures and javadocs
1 parent 3a4251f commit cf70523

File tree

5 files changed

+98
-83
lines changed

5 files changed

+98
-83
lines changed

src/main/java/com/hivemq/client/mqtt/mqtt3/message/subscribe/Mqtt3SubscribeBuilderBase.java

+20-17
Original file line numberDiff line numberDiff line change
@@ -43,43 +43,46 @@ public interface Mqtt3SubscribeBuilderBase<C extends Mqtt3SubscribeBuilderBase<C
4343
@NotNull C addSubscription(@NotNull Mqtt3Subscription subscription);
4444

4545
/**
46-
* Adds a collection of {@link Mqtt3Subscription} to the {@link Mqtt3Subscribe#getSubscriptions() list of
47-
* subscriptions}. At least one subscription in the collection is mandatory.
46+
* Fluent counterpart of {@link #addSubscription(Mqtt3Subscription)}.
47+
* <p>
48+
* Calling {@link Mqtt3SubscriptionBuilder.Nested.Complete#applySubscription()} on the returned builder has the same
49+
* effect as calling {@link #addSubscription(Mqtt3Subscription)} with the result of {@link
50+
* Mqtt3SubscriptionBuilder.Complete#build()}.
4851
*
49-
* @param subscriptions the subscriptions.
50-
* @return the builder that is now complete as at least one subscription is set.
52+
* @return the fluent builder for the subscription.
53+
* @see #addSubscription(Mqtt3Subscription)
5154
*/
52-
@NotNull C addSubscriptions(@NotNull Collection<Mqtt3Subscription> subscriptions);
55+
@NotNull Mqtt3SubscriptionBuilder.Nested<? extends C> addSubscription();
5356

5457
/**
5558
* Adds {@link Mqtt3Subscription}s to the {@link Mqtt3Subscribe#getSubscriptions() list of subscriptions}. At least
5659
* one subscription is mandatory.
5760
*
5861
* @param subscriptions the subscriptions.
5962
* @return the builder that is now complete as at least one subscription is set.
63+
* @since 1.2
6064
*/
61-
@NotNull C addSubscriptions(@NotNull Mqtt3Subscription... subscriptions);
65+
@NotNull C addSubscriptions(@NotNull Mqtt3Subscription @NotNull ... subscriptions);
6266

6367
/**
64-
* Adds a stream of {@link Mqtt3Subscription}s to the {@link Mqtt3Subscribe#getSubscriptions() list of
68+
* Adds a collection of {@link Mqtt3Subscription}s to the {@link Mqtt3Subscribe#getSubscriptions() list of
6569
* subscriptions}. At least one subscription is mandatory.
6670
*
67-
* @param subscriptions the subscriptions.
71+
* @param subscriptions the collection of subscriptions.
6872
* @return the builder that is now complete as at least one subscription is set.
73+
* @since 1.2
6974
*/
70-
@NotNull C addSubscriptions(@NotNull Stream<Mqtt3Subscription> subscriptions);
75+
@NotNull C addSubscriptions(@NotNull Collection<@NotNull Mqtt3Subscription> subscriptions);
7176

7277
/**
73-
* Fluent counterpart of {@link #addSubscription(Mqtt3Subscription)}.
74-
* <p>
75-
* Calling {@link Mqtt3SubscriptionBuilder.Nested.Complete#applySubscription()} on the returned builder has the same
76-
* effect as calling {@link #addSubscription(Mqtt3Subscription)} with the result of {@link
77-
* Mqtt3SubscriptionBuilder.Complete#build()}.
78+
* Adds a stream of {@link Mqtt3Subscription}s to the {@link Mqtt3Subscribe#getSubscriptions() list of
79+
* subscriptions}. At least one subscription is mandatory.
7880
*
79-
* @return the fluent builder for the subscription.
80-
* @see #addSubscription(Mqtt3Subscription)
81+
* @param subscriptions the stream of subscriptions.
82+
* @return the builder that is now complete as at least one subscription is set.
83+
* @since 1.2
8184
*/
82-
@NotNull Mqtt3SubscriptionBuilder.Nested<? extends C> addSubscription();
85+
@NotNull C addSubscriptions(@NotNull Stream<@NotNull Mqtt3Subscription> subscriptions);
8386

8487
/**
8588
* {@link Mqtt3SubscribeBuilderBase} that provides additional methods for the first subscription.

src/main/java/com/hivemq/client/mqtt/mqtt3/message/unsubscribe/Mqtt3UnsubscribeBuilderBase.java

+23-20
Original file line numberDiff line numberDiff line change
@@ -55,43 +55,46 @@ public interface Mqtt3UnsubscribeBuilderBase<C extends Mqtt3UnsubscribeBuilderBa
5555
@NotNull C addTopicFilter(@NotNull MqttTopicFilter topicFilter);
5656

5757
/**
58-
* Adds a collection of{@link MqttTopicFilter Topic Filter} to the {@link Mqtt3Unsubscribe#getTopicFilters() list of
59-
* Topic Filters}. At least one Topic Filter is mandatory.
58+
* Fluent counterpart of {@link #addTopicFilter(MqttTopicFilter)}.
59+
* <p>
60+
* Calling {@link MqttTopicFilterBuilder.Nested.Complete#applyTopicFilter()} on the returned builder has the same
61+
* effect as calling {@link #addTopicFilter(MqttTopicFilter)} with the result of {@link
62+
* MqttTopicFilterBuilder.Complete#build()}.
6063
*
61-
* @param topicFilters the Topic Filter's.
62-
* @return the builder that is now complete as at least one Topic Filter is set.
64+
* @return the fluent builder for the Topic Filter.
65+
* @see #addTopicFilter(MqttTopicFilter)
6366
*/
64-
@NotNull C addTopicFilters(@NotNull Collection<MqttTopicFilter> topicFilters);
67+
@NotNull MqttTopicFilterBuilder.Nested<? extends C> addTopicFilter();
6568

6669
/**
67-
* Adds {@link MqttTopicFilter Topic Filter}s to the {@link Mqtt3Unsubscribe#getTopicFilters() list of Topic
70+
* Adds {@link MqttTopicFilter Topic Filters} to the {@link Mqtt3Unsubscribe#getTopicFilters() list of Topic
6871
* Filters}. At least one Topic Filter is mandatory.
6972
*
70-
* @param topicFilters the Topic Filter's.
73+
* @param topicFilters the Topic Filters.
7174
* @return the builder that is now complete as at least one Topic Filter is set.
75+
* @since 1.2
7276
*/
73-
@NotNull C addTopicFilters(@NotNull MqttTopicFilter... topicFilters);
77+
@NotNull C addTopicFilters(@NotNull MqttTopicFilter @NotNull ... topicFilters);
7478

7579
/**
76-
* Adds a stream of{@link MqttTopicFilter Topic Filter} to the {@link Mqtt3Unsubscribe#getTopicFilters() list of
77-
* Topic Filters}. At least one Topic Filter is mandatory.
80+
* Adds a collection of {@link MqttTopicFilter Topic Filters} to the {@link Mqtt3Unsubscribe#getTopicFilters() list
81+
* of Topic Filters}. At least one Topic Filter is mandatory.
7882
*
79-
* @param topicFilters the Topic Filter's.
83+
* @param topicFilters the collection of Topic Filters.
8084
* @return the builder that is now complete as at least one Topic Filter is set.
85+
* @since 1.2
8186
*/
82-
@NotNull C addTopicFilters(@NotNull Stream<MqttTopicFilter> topicFilters);
87+
@NotNull C addTopicFilters(@NotNull Collection<@NotNull MqttTopicFilter> topicFilters);
8388

8489
/**
85-
* Fluent counterpart of {@link #addTopicFilter(MqttTopicFilter)}.
86-
* <p>
87-
* Calling {@link MqttTopicFilterBuilder.Nested.Complete#applyTopicFilter()} on the returned builder has the same
88-
* effect as calling {@link #addTopicFilter(MqttTopicFilter)} with the result of {@link
89-
* MqttTopicFilterBuilder.Complete#build()}.
90+
* Adds a stream of {@link MqttTopicFilter Topic Filters} to the {@link Mqtt3Unsubscribe#getTopicFilters() list of
91+
* Topic Filters}. At least one Topic Filter is mandatory.
9092
*
91-
* @return the fluent builder for the Topic Filter.
92-
* @see #addTopicFilter(MqttTopicFilter)
93+
* @param topicFilters the stream of Topic Filters.
94+
* @return the builder that is now complete as at least one Topic Filter is set.
95+
* @since 1.2
9396
*/
94-
@NotNull MqttTopicFilterBuilder.Nested<? extends C> addTopicFilter();
97+
@NotNull C addTopicFilters(@NotNull Stream<@NotNull MqttTopicFilter> topicFilters);
9598

9699
/**
97100
* Reverses the subscriptions of a Subscribe message by adding their Topic Filters.

src/main/java/com/hivemq/client/mqtt/mqtt5/datatypes/Mqtt5UserPropertiesBuilderBase.java

+11-8
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,29 @@ public interface Mqtt5UserPropertiesBuilderBase<B extends Mqtt5UserPropertiesBui
6161
@NotNull B add(@NotNull Mqtt5UserProperty userProperty);
6262

6363
/**
64-
* Adds a collection of {@link Mqtt5UserProperty User Property}.
64+
* Adds {@link Mqtt5UserProperty User Properties}.
6565
*
6666
* @param userProperties the User Properties.
6767
* @return the builder.
68+
* @since 1.2
6869
*/
69-
@NotNull B addAll(@NotNull Collection<Mqtt5UserProperty> userProperties);
70+
@NotNull B addAll(@NotNull Mqtt5UserProperty @NotNull ... userProperties);
7071

7172
/**
72-
* Add {@link Mqtt5UserProperty User Properties}.
73+
* Adds a collection of {@link Mqtt5UserProperty User Properties}.
7374
*
74-
* @param userProperties the User Properties.
75+
* @param userProperties the collection of User Properties.
7576
* @return the builder.
77+
* @since 1.2
7678
*/
77-
@NotNull B addAll(@NotNull Mqtt5UserProperty... userProperties);
79+
@NotNull B addAll(@NotNull Collection<@NotNull Mqtt5UserProperty> userProperties);
7880

7981
/**
80-
* Adds a stream of {@link Mqtt5UserProperty User Property}.
82+
* Adds a stream of {@link Mqtt5UserProperty User Properties}.
8183
*
82-
* @param userProperties the User Properties.
84+
* @param userProperties the stream of User Properties.
8385
* @return the builder.
86+
* @since 1.2
8487
*/
85-
@NotNull B addAll(@NotNull Stream<Mqtt5UserProperty> userProperties);
88+
@NotNull B addAll(@NotNull Stream<@NotNull Mqtt5UserProperty> userProperties);
8689
}

src/main/java/com/hivemq/client/mqtt/mqtt5/message/subscribe/Mqtt5SubscribeBuilderBase.java

+21-18
Original file line numberDiff line numberDiff line change
@@ -45,43 +45,46 @@ public interface Mqtt5SubscribeBuilderBase<C extends Mqtt5SubscribeBuilderBase.C
4545
@NotNull C addSubscription(@NotNull Mqtt5Subscription subscription);
4646

4747
/**
48-
* Adds a collection of {@link Mqtt5Subscription} to the {@link Mqtt5Subscribe#getSubscriptions() list of
49-
* subscriptions}. At least one subscription in the collection is mandatory.
48+
* Fluent counterpart of {@link #addSubscription(Mqtt5Subscription)}.
49+
* <p>
50+
* Calling {@link Mqtt5SubscriptionBuilder.Nested.Complete#applySubscription()} on the returned builder has the same
51+
* effect as calling {@link #addSubscription(Mqtt5Subscription)} with the result of {@link
52+
* Mqtt5SubscriptionBuilder.Complete#build()}.
5053
*
51-
* @param subscriptions the subscriptions.
52-
* @return the builder that is now complete as at least one subscription is set.
54+
* @return the fluent builder for the subscription.
55+
* @see #addSubscription(Mqtt5Subscription)
5356
*/
54-
@NotNull C addSubscriptions(@NotNull Collection<Mqtt5Subscription> subscriptions);
57+
@NotNull Mqtt5SubscriptionBuilder.Nested<? extends C> addSubscription();
5558

5659
/**
5760
* Adds {@link Mqtt5Subscription}s to the {@link Mqtt5Subscribe#getSubscriptions() list of subscriptions}. At least
5861
* one subscription is mandatory.
5962
*
6063
* @param subscriptions the subscriptions.
6164
* @return the builder that is now complete as at least one subscription is set.
65+
* @since 1.2
6266
*/
63-
@NotNull C addSubscriptions(@NotNull Mqtt5Subscription... subscriptions);
67+
@NotNull C addSubscriptions(@NotNull Mqtt5Subscription @NotNull ... subscriptions);
6468

6569
/**
66-
* Adds a stream of {@link Mqtt5Subscription}s to the {@link Mqtt5Subscribe#getSubscriptions() list of
67-
* subscriptions}. At least one subscription is mandatory.
70+
* Adds a collection of {@link Mqtt5Subscription}s to the {@link Mqtt5Subscribe#getSubscriptions() list of
71+
* subscriptions}. At least one subscription in the collection is mandatory.
6872
*
69-
* @param subscriptions the subscriptions.
73+
* @param subscriptions the collection of subscriptions.
7074
* @return the builder that is now complete as at least one subscription is set.
75+
* @since 1.2
7176
*/
72-
@NotNull C addSubscriptions(@NotNull Stream<Mqtt5Subscription> subscriptions);
77+
@NotNull C addSubscriptions(@NotNull Collection<@NotNull Mqtt5Subscription> subscriptions);
7378

7479
/**
75-
* Fluent counterpart of {@link #addSubscription(Mqtt5Subscription)}.
76-
* <p>
77-
* Calling {@link Mqtt5SubscriptionBuilder.Nested.Complete#applySubscription()} on the returned builder has the same
78-
* effect as calling {@link #addSubscription(Mqtt5Subscription)} with the result of {@link
79-
* Mqtt5SubscriptionBuilder.Complete#build()}.
80+
* Adds a stream of {@link Mqtt5Subscription}s to the {@link Mqtt5Subscribe#getSubscriptions() list of
81+
* subscriptions}. At least one subscription is mandatory.
8082
*
81-
* @return the fluent builder for the subscription.
82-
* @see #addSubscription(Mqtt5Subscription)
83+
* @param subscriptions the stream of subscriptions.
84+
* @return the builder that is now complete as at least one subscription is set.
85+
* @since 1.2
8386
*/
84-
@NotNull Mqtt5SubscriptionBuilder.Nested<? extends C> addSubscription();
87+
@NotNull C addSubscriptions(@NotNull Stream<@NotNull Mqtt5Subscription> subscriptions);
8588

8689
/**
8790
* {@link Mqtt5SubscribeBuilderBase} that is complete which means all mandatory fields are set.

src/main/java/com/hivemq/client/mqtt/mqtt5/message/unsubscribe/Mqtt5UnsubscribeBuilderBase.java

+23-20
Original file line numberDiff line numberDiff line change
@@ -57,43 +57,46 @@ public interface Mqtt5UnsubscribeBuilderBase<C extends Mqtt5UnsubscribeBuilderBa
5757
@NotNull C addTopicFilter(@NotNull MqttTopicFilter topicFilter);
5858

5959
/**
60-
* Adds a collection of {@link MqttTopicFilter Topic Filter} to the {@link Mqtt5Unsubscribe#getTopicFilters() list
61-
* of Topic Filters}. At least one Topic Filter is mandatory.
60+
* Fluent counterpart of {@link #addTopicFilter(MqttTopicFilter)}.
61+
* <p>
62+
* Calling {@link MqttTopicFilterBuilder.Nested.Complete#applyTopicFilter()} on the returned builder has the same
63+
* effect as calling {@link #addTopicFilter(MqttTopicFilter)} with the result of {@link
64+
* MqttTopicFilterBuilder.Complete#build()}.
6265
*
63-
* @param topicFilters the Topic Filter's.
64-
* @return the builder that is now complete as at least one Topic Filter is set.
66+
* @return the fluent builder for the Topic Filter.
67+
* @see #addTopicFilter(MqttTopicFilter)
6568
*/
66-
@NotNull C addTopicFilters(@NotNull Collection<MqttTopicFilter> topicFilters);
69+
@NotNull MqttTopicFilterBuilder.Nested<? extends C> addTopicFilter();
6770

6871
/**
69-
* Adds {@link MqttTopicFilter Topic Filter}s to the {@link Mqtt5Unsubscribe#getTopicFilters() list of Topic
72+
* Adds {@link MqttTopicFilter Topic Filters} to the {@link Mqtt5Unsubscribe#getTopicFilters() list of Topic
7073
* Filters}. At least one Topic Filter is mandatory.
7174
*
72-
* @param topicFilters the Topic Filter's.
75+
* @param topicFilters the Topic Filters.
7376
* @return the builder that is now complete as at least one Topic Filter is set.
77+
* @since 1.2
7478
*/
75-
@NotNull C addTopicFilters(@NotNull MqttTopicFilter... topicFilters);
79+
@NotNull C addTopicFilters(@NotNull MqttTopicFilter @NotNull ... topicFilters);
7680

7781
/**
78-
* Adds a stream of {@link MqttTopicFilter Topic Filter} to the {@link Mqtt5Unsubscribe#getTopicFilters() list of
79-
* Topic Filters}. At least one Topic Filter is mandatory.
82+
* Adds a collection of {@link MqttTopicFilter Topic Filters} to the {@link Mqtt5Unsubscribe#getTopicFilters() list
83+
* of Topic Filters}. At least one Topic Filter is mandatory.
8084
*
81-
* @param topicFilters the Topic Filter's.
85+
* @param topicFilters the collection of Topic Filters.
8286
* @return the builder that is now complete as at least one Topic Filter is set.
87+
* @since 1.2
8388
*/
84-
@NotNull C addTopicFilters(@NotNull Stream<MqttTopicFilter> topicFilters);
89+
@NotNull C addTopicFilters(@NotNull Collection<@NotNull MqttTopicFilter> topicFilters);
8590

8691
/**
87-
* Fluent counterpart of {@link #addTopicFilter(MqttTopicFilter)}.
88-
* <p>
89-
* Calling {@link MqttTopicFilterBuilder.Nested.Complete#applyTopicFilter()} on the returned builder has the same
90-
* effect as calling {@link #addTopicFilter(MqttTopicFilter)} with the result of {@link
91-
* MqttTopicFilterBuilder.Complete#build()}.
92+
* Adds a stream of {@link MqttTopicFilter Topic Filters} to the {@link Mqtt5Unsubscribe#getTopicFilters() list of
93+
* Topic Filters}. At least one Topic Filter is mandatory.
9294
*
93-
* @return the fluent builder for the Topic Filter.
94-
* @see #addTopicFilter(MqttTopicFilter)
95+
* @param topicFilters the stream of Topic Filters.
96+
* @return the builder that is now complete as at least one Topic Filter is set.
97+
* @since 1.2
9598
*/
96-
@NotNull MqttTopicFilterBuilder.Nested<? extends C> addTopicFilter();
99+
@NotNull C addTopicFilters(@NotNull Stream<@NotNull MqttTopicFilter> topicFilters);
97100

98101
/**
99102
* Reverses the subscriptions of a Subscribe message by adding their Topic Filters.

0 commit comments

Comments
 (0)