Added counter(Mqtt5Subscribe) method to Mqtt5UnsubscribeBuilder
@@ -5,6 +5,8 @@ import com.google.common.collect.ImmutableList;
import org.mqttbee.annotations.NotNull;
import org.mqttbee.api.mqtt.datatypes.MqttTopicFilter;
import org.mqttbee.api.mqtt.mqtt5.datatypes.Mqtt5UserProperties;
+import org.mqttbee.api.mqtt.mqtt5.message.subscribe.Mqtt5Subscribe;
+import org.mqttbee.api.mqtt.mqtt5.message.subscribe.Mqtt5Subscription;
import org.mqttbee.mqtt.codec.encoder.mqtt5.Mqtt5UnsubscribeEncoder;
import org.mqttbee.mqtt.datatypes.MqttTopicFilterImpl;
import org.mqttbee.mqtt.datatypes.MqttUserPropertiesImpl;
@@ -34,6 +36,15 @@ public class Mqtt5UnsubscribeBuilder {
return this;
}
+ @NotNull
+ public Mqtt5UnsubscribeBuilder counter(@NotNull final Mqtt5Subscribe subscribe) {
+ final ImmutableList<? extends Mqtt5Subscription> subscriptions = subscribe.getSubscriptions();
+ for (final Mqtt5Subscription subscription : subscriptions) {
+ addTopicFilter(subscription.getTopicFilter());
+ }
+ return this;
+ }
+
@NotNull
public Mqtt5UnsubscribeBuilder withUserProperties(@NotNull final Mqtt5UserProperties userProperties) {
this.userProperties = MqttBuilderUtil.userProperties(userProperties);
