cn.leancloud.command.SessionAckPacket Maven / Gradle / Ivy
package cn.leancloud.command;
import cn.leancloud.Messages;
import java.util.ArrayList;
import java.util.List;
public class SessionAckPacket extends PeerBasedCommandPacket {
List ids;
public SessionAckPacket() {
this.setCmd("ack");
}
public void setMessageId(String id) {
ids = new ArrayList(1);
ids.add(id);
}
@Override
protected Messages.GenericCommand.Builder getGenericCommandBuilder() {
Messages.GenericCommand.Builder builder = super.getGenericCommandBuilder();
builder.setAckMessage(getAckCommand());
return builder;
}
protected Messages.AckCommand getAckCommand() {
Messages.AckCommand.Builder builder = Messages.AckCommand.newBuilder();
if (null != ids && ids.size() > 0) {
builder.addAllIds(ids);
}
return builder.build();
}
}