com.urbanairship.api.channel.model.ChannelUninstallPayload Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
The Urban Airship Java client library
package com.urbanairship.api.channel.model;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
/**
* Represents a Channel Uninstall payload for the Airship API.
*/
public class ChannelUninstallPayload extends ChannelModelObject {
private final Set channels;
private ChannelUninstallPayload(Set channels) {
this.channels = channels;
}
/**
* ChannelUninstallPayload Builder
*
* @return Builder
*/
public static Builder newBuilder() {
return new Builder();
}
/**
* Get the list of channels to uninstall.
*
* @return Set of ChannelUninstallDevice
*/
public Set getChannels() {
return channels;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ChannelUninstallPayload that = (ChannelUninstallPayload) o;
return Objects.equal(channels, that.channels);
}
@Override
public int hashCode() {
return Objects.hashCode(channels);
}
@Override
public String toString() {
return "ChannelUninstallDevice{" +
"channels=" + channels +
'}';
}
public static class Builder {
ImmutableSet.Builder channelsBuilder = ImmutableSet.builder();
/**
* Set the Set of ChannelUninstallDevice.
*
* @param channels Set of ChannelUninstallDevice
* @return Builder
*/
public Builder setChannels(Set channels) {
channelsBuilder.addAll(channels);
return this;
}
public ChannelUninstallPayload build() {
ImmutableSet channels = channelsBuilder.build();
Preconditions.checkArgument(channels.size() > 0, "At least one channel must be set.");
Preconditions.checkArgument(channels.size() <= 1000, "Maximum of 1000 channels per payload.");
return new ChannelUninstallPayload(channels);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy