Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement/add all methods generics #387

Merged
merged 2 commits into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ public abstract class MqttUserPropertiesImplBuilder<B extends MqttUserProperties
return self();
}

public @NotNull B addAll(final @Nullable Collection<@Nullable Mqtt5UserProperty> userProperties) {
public @NotNull B addAll(final @Nullable Collection<@Nullable ? extends Mqtt5UserProperty> userProperties) {
Checks.notNull(userProperties, "User Properties");
listBuilder.ensureFree(userProperties.size());
userProperties.forEach(this::add);
return self();
}

public @NotNull B addAll(final @Nullable Stream<@Nullable Mqtt5UserProperty> userProperties) {
public @NotNull B addAll(final @Nullable Stream<@Nullable ? extends Mqtt5UserProperty> userProperties) {
Checks.notNull(userProperties, "User Properties");
userProperties.forEach(this::add);
return self();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ protected MqttSubscribeBuilder() {
return self();
}

public @NotNull B addSubscriptions(final @Nullable Collection<@Nullable Mqtt5Subscription> subscriptions) {
public @NotNull B addSubscriptions(
final @Nullable Collection<@Nullable ? extends Mqtt5Subscription> subscriptions) {

Checks.notNull(subscriptions, "Subscriptions");
buildFirstSubscription();
subscriptionsBuilder.ensureFree(subscriptions.size());
Expand All @@ -87,7 +89,7 @@ protected MqttSubscribeBuilder() {
return self();
}

public @NotNull B addSubscriptions(final @Nullable Stream<@Nullable Mqtt5Subscription> subscriptions) {
public @NotNull B addSubscriptions(final @Nullable Stream<@Nullable ? extends Mqtt5Subscription> subscriptions) {
Checks.notNull(subscriptions, "Subscriptions");
buildFirstSubscription();
subscriptions.forEach(this::addSubscription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ protected Mqtt3SubscribeViewBuilder() {
return self();
}

public @NotNull B addSubscriptions(final @Nullable Collection<@Nullable Mqtt3Subscription> subscriptions) {
public @NotNull B addSubscriptions(
final @Nullable Collection<@Nullable ? extends Mqtt3Subscription> subscriptions) {

Checks.notNull(subscriptions, "Subscriptions");
buildFirstSubscription();
subscriptionsBuilder.ensureFree(subscriptions.size());
Expand All @@ -83,7 +85,7 @@ protected Mqtt3SubscribeViewBuilder() {
return self();
}

public @NotNull B addSubscriptions(final @Nullable Stream<@Nullable Mqtt3Subscription> subscriptions) {
public @NotNull B addSubscriptions(final @Nullable Stream<@Nullable ? extends Mqtt3Subscription> subscriptions) {
Checks.notNull(subscriptions, "Subscriptions");
buildFirstSubscription();
subscriptions.forEach(this::addSubscription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ public abstract class MqttUnsubscribeBuilder<B extends MqttUnsubscribeBuilder<B>
return self();
}

public @NotNull B addTopicFilters(final @Nullable Collection<@Nullable MqttTopicFilter> topicFilters) {
public @NotNull B addTopicFilters(final @Nullable Collection<@Nullable ? extends MqttTopicFilter> topicFilters) {
Checks.notNull(topicFilters, "Topic Filters");
topicFiltersBuilder.ensureFree(topicFilters.size());
topicFilters.forEach(this::addTopicFilter);
ensureAtLeastOneSubscription();
return self();
}

public @NotNull B addTopicFilters(final @Nullable Stream<@Nullable MqttTopicFilter> topicFilters) {
public @NotNull B addTopicFilters(final @Nullable Stream<@Nullable ? extends MqttTopicFilter> topicFilters) {
Checks.notNull(topicFilters, "Topic Filters");
topicFilters.forEach(this::addTopicFilter);
ensureAtLeastOneSubscription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ public abstract class Mqtt3UnsubscribeViewBuilder<B extends Mqtt3UnsubscribeView
return self();
}

public @NotNull B addTopicFilters(final @Nullable Collection<@Nullable MqttTopicFilter> topicFilters) {
public @NotNull B addTopicFilters(final @Nullable Collection<@Nullable ? extends MqttTopicFilter> topicFilters) {
Checks.notNull(topicFilters, "Topic Filters");
topicFiltersBuilder.ensureFree(topicFilters.size());
topicFilters.forEach(this::addTopicFilter);
ensureAtLeastOneSubscription();
return self();
}

public @NotNull B addTopicFilters(final @Nullable Stream<@Nullable MqttTopicFilter> topicFilters) {
public @NotNull B addTopicFilters(final @Nullable Stream<@Nullable ? extends MqttTopicFilter> topicFilters) {
Checks.notNull(topicFilters, "Topic Filters");
topicFilters.forEach(this::addTopicFilter);
ensureAtLeastOneSubscription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public interface MqttWebSocketConfigBuilderBase<B extends MqttWebSocketConfigBui
* @param queryString the query string.
* @return the builder.
*/
@CheckReturnValue
@NotNull B queryString(@NotNull String queryString);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public interface Mqtt3SubscribeBuilderBase<C extends Mqtt3SubscribeBuilderBase<C
* @return the builder that is now complete as at least one subscription is set.
* @since 1.2
*/
@CheckReturnValue
@NotNull C addSubscriptions(@NotNull Mqtt3Subscription @NotNull ... subscriptions);

/**
Expand All @@ -75,7 +76,8 @@ public interface Mqtt3SubscribeBuilderBase<C extends Mqtt3SubscribeBuilderBase<C
* @return the builder that is now complete as at least one subscription is set.
* @since 1.2
*/
@NotNull C addSubscriptions(@NotNull Collection<@NotNull Mqtt3Subscription> subscriptions);
@CheckReturnValue
@NotNull C addSubscriptions(@NotNull Collection<@NotNull ? extends Mqtt3Subscription> subscriptions);

/**
* Adds a stream of {@link Mqtt3Subscription}s to the {@link Mqtt3Subscribe#getSubscriptions() list of
Expand All @@ -85,7 +87,8 @@ public interface Mqtt3SubscribeBuilderBase<C extends Mqtt3SubscribeBuilderBase<C
* @return the builder that is now complete as at least one subscription is set.
* @since 1.2
*/
@NotNull C addSubscriptions(@NotNull Stream<@NotNull Mqtt3Subscription> subscriptions);
@CheckReturnValue
@NotNull C addSubscriptions(@NotNull Stream<@NotNull ? extends Mqtt3Subscription> subscriptions);

/**
* {@link Mqtt3SubscribeBuilderBase} that provides additional methods for the first subscription.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public interface Mqtt3UnsubscribeBuilderBase<C extends Mqtt3UnsubscribeBuilderBa
* @return the builder that is now complete as at least one Topic Filter is set.
* @since 1.2
*/
@CheckReturnValue
@NotNull C addTopicFilters(@NotNull MqttTopicFilter @NotNull ... topicFilters);

/**
Expand All @@ -88,7 +89,8 @@ public interface Mqtt3UnsubscribeBuilderBase<C extends Mqtt3UnsubscribeBuilderBa
* @return the builder that is now complete as at least one Topic Filter is set.
* @since 1.2
*/
@NotNull C addTopicFilters(@NotNull Collection<@NotNull MqttTopicFilter> topicFilters);
@CheckReturnValue
@NotNull C addTopicFilters(@NotNull Collection<@NotNull ? extends MqttTopicFilter> topicFilters);

/**
* Adds a stream of {@link MqttTopicFilter Topic Filters} to the {@link Mqtt3Unsubscribe#getTopicFilters() list of
Expand All @@ -98,7 +100,8 @@ public interface Mqtt3UnsubscribeBuilderBase<C extends Mqtt3UnsubscribeBuilderBa
* @return the builder that is now complete as at least one Topic Filter is set.
* @since 1.2
*/
@NotNull C addTopicFilters(@NotNull Stream<@NotNull MqttTopicFilter> topicFilters);
@CheckReturnValue
@NotNull C addTopicFilters(@NotNull Stream<@NotNull ? extends MqttTopicFilter> topicFilters);

/**
* Reverses the subscriptions of a Subscribe message by adding their Topic Filters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public interface Mqtt5UserPropertiesBuilderBase<B extends Mqtt5UserPropertiesBui
* @return the builder.
* @since 1.2
*/
@CheckReturnValue
@NotNull B addAll(@NotNull Mqtt5UserProperty @NotNull ... userProperties);

/**
Expand All @@ -80,7 +81,8 @@ public interface Mqtt5UserPropertiesBuilderBase<B extends Mqtt5UserPropertiesBui
* @return the builder.
* @since 1.2
*/
@NotNull B addAll(@NotNull Collection<@NotNull Mqtt5UserProperty> userProperties);
@CheckReturnValue
@NotNull B addAll(@NotNull Collection<@NotNull ? extends Mqtt5UserProperty> userProperties);

/**
* Adds a stream of {@link Mqtt5UserProperty User Properties}.
Expand All @@ -89,5 +91,6 @@ public interface Mqtt5UserPropertiesBuilderBase<B extends Mqtt5UserPropertiesBui
* @return the builder.
* @since 1.2
*/
@NotNull B addAll(@NotNull Stream<@NotNull Mqtt5UserProperty> userProperties);
@CheckReturnValue
@NotNull B addAll(@NotNull Stream<@NotNull ? extends Mqtt5UserProperty> userProperties);
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public interface Mqtt5SubscribeBuilderBase<C extends Mqtt5SubscribeBuilderBase.C
* @return the builder that is now complete as at least one subscription is set.
* @since 1.2
*/
@CheckReturnValue
@NotNull C addSubscriptions(@NotNull Mqtt5Subscription @NotNull ... subscriptions);

/**
Expand All @@ -77,7 +78,8 @@ public interface Mqtt5SubscribeBuilderBase<C extends Mqtt5SubscribeBuilderBase.C
* @return the builder that is now complete as at least one subscription is set.
* @since 1.2
*/
@NotNull C addSubscriptions(@NotNull Collection<@NotNull Mqtt5Subscription> subscriptions);
@CheckReturnValue
@NotNull C addSubscriptions(@NotNull Collection<@NotNull ? extends Mqtt5Subscription> subscriptions);

/**
* Adds a stream of {@link Mqtt5Subscription}s to the {@link Mqtt5Subscribe#getSubscriptions() list of
Expand All @@ -87,7 +89,8 @@ public interface Mqtt5SubscribeBuilderBase<C extends Mqtt5SubscribeBuilderBase.C
* @return the builder that is now complete as at least one subscription is set.
* @since 1.2
*/
@NotNull C addSubscriptions(@NotNull Stream<@NotNull Mqtt5Subscription> subscriptions);
@CheckReturnValue
@NotNull C addSubscriptions(@NotNull Stream<@NotNull ? extends Mqtt5Subscription> subscriptions);

/**
* {@link Mqtt5SubscribeBuilderBase} that is complete which means all mandatory fields are set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public interface Mqtt5UnsubscribeBuilderBase<C extends Mqtt5UnsubscribeBuilderBa
* @return the builder that is now complete as at least one Topic Filter is set.
* @since 1.2
*/
@CheckReturnValue
@NotNull C addTopicFilters(@NotNull MqttTopicFilter @NotNull ... topicFilters);

/**
Expand All @@ -90,7 +91,8 @@ public interface Mqtt5UnsubscribeBuilderBase<C extends Mqtt5UnsubscribeBuilderBa
* @return the builder that is now complete as at least one Topic Filter is set.
* @since 1.2
*/
@NotNull C addTopicFilters(@NotNull Collection<@NotNull MqttTopicFilter> topicFilters);
@CheckReturnValue
@NotNull C addTopicFilters(@NotNull Collection<@NotNull ? extends MqttTopicFilter> topicFilters);

/**
* Adds a stream of {@link MqttTopicFilter Topic Filters} to the {@link Mqtt5Unsubscribe#getTopicFilters() list of
Expand All @@ -100,7 +102,8 @@ public interface Mqtt5UnsubscribeBuilderBase<C extends Mqtt5UnsubscribeBuilderBa
* @return the builder that is now complete as at least one Topic Filter is set.
* @since 1.2
*/
@NotNull C addTopicFilters(@NotNull Stream<@NotNull MqttTopicFilter> topicFilters);
@CheckReturnValue
@NotNull C addTopicFilters(@NotNull Stream<@NotNull ? extends MqttTopicFilter> topicFilters);

/**
* Reverses the subscriptions of a Subscribe message by adding their Topic Filters.
Expand Down