
com.urbanairship.connect.client.model.responses.ControlEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of connect-client Show documentation
Show all versions of connect-client Show documentation
The UA Connect Java client library
package com.urbanairship.connect.client.model.responses;
import com.google.common.base.Optional;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import com.urbanairship.connect.client.model.EventType;
import com.urbanairship.connect.client.model.GsonUtil;
public class ControlEvent implements EventBody {
@SerializedName("push_id")
private final String pushId;
@SerializedName("group_id")
private final Optional groupId;
@Override
public EventType getType() {
return EventType.CONTROL;
}
private ControlEvent() {
this(null, Optional.absent());
}
public ControlEvent(String pushId, Optional groupId) {
this.pushId = pushId;
this.groupId = groupId;
}
public Optional getGroupId() {
return groupId;
}
public String getPushId() {
return pushId;
}
public static ControlEvent parseJSONfromBytes(byte[] bytes) {
JsonObject jsonObject = GsonUtil.parseJSONfromBytes(bytes);
return parseJSON(jsonObject.toString());
}
public static ControlEvent parseJSON(String s) {
return GsonUtil.getGson().fromJson(s, ControlEvent.class);
}
public byte[] serializeToJSONBytes() {
return GsonUtil.serializeToJSONBytes(this, ControlEvent.class);
}
@Override
public String toString() {
return "ControlEvent{" +
"pushId='" + pushId + '\'' +
", groupId=" + groupId +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final ControlEvent that = (ControlEvent) o;
if (!pushId.equals(that.pushId)) return false;
return groupId.equals(that.groupId);
}
@Override
public int hashCode() {
int result = pushId.hashCode();
result = 31 * result + groupId.hashCode();
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy