/**
* Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package org.apache.hadoop.corona;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class KillSessionsArgs implements org.apache.thrift.TBase<KillSessionsArgs, KillSessionsArgs._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("KillSessionsArgs");
private static final org.apache.thrift.protocol.TField SESSION_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("sessionIds", org.apache.thrift.protocol.TType.LIST, (short)1);
private static final org.apache.thrift.protocol.TField WHO_FIELD_DESC = new org.apache.thrift.protocol.TField("who", org.apache.thrift.protocol.TType.STRING, (short)2);
public List<String> sessionIds; // required
public String who; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SESSION_IDS((short)1, "sessionIds"),
WHO((short)2, "who");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // SESSION_IDS
return SESSION_IDS;
case 2: // WHO
return WHO;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SESSION_IDS, new org.apache.thrift.meta_data.FieldMetaData("sessionIds", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
tmpMap.put(_Fields.WHO, new org.apache.thrift.meta_data.FieldMetaData("who", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(KillSessionsArgs.class, metaDataMap);
}
public KillSessionsArgs() {
}
public KillSessionsArgs(
List<String> sessionIds,
String who)
{
this();
this.sessionIds = sessionIds;
this.who = who;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public KillSessionsArgs(KillSessionsArgs other) {
if (other.isSetSessionIds()) {
List<String> __this__sessionIds = new ArrayList<String>();
for (String other_element : other.sessionIds) {
__this__sessionIds.add(other_element);
}
this.sessionIds = __this__sessionIds;
}
if (other.isSetWho()) {
this.who = other.who;
}
}
public KillSessionsArgs deepCopy() {
return new KillSessionsArgs(this);
}
@Override
public void clear() {
this.sessionIds = null;
this.who = null;
}
public int getSessionIdsSize() {
return (this.sessionIds == null) ? 0 : this.sessionIds.size();
}
public java.util.Iterator<String> getSessionIdsIterator() {
return (this.sessionIds == null) ? null : this.sessionIds.iterator();
}
public void addToSessionIds(String elem) {
if (this.sessionIds == null) {
this.sessionIds = new ArrayList<String>();
}
this.sessionIds.add(elem);
}
public List<String> getSessionIds() {
return this.sessionIds;
}
public KillSessionsArgs setSessionIds(List<String> sessionIds) {
this.sessionIds = sessionIds;
return this;
}
public void unsetSessionIds() {
this.sessionIds = null;
}
/** Returns true if field sessionIds is set (has been assigned a value) and false otherwise */
public boolean isSetSessionIds() {
return this.sessionIds != null;
}
public void setSessionIdsIsSet(boolean value) {
if (!value) {
this.sessionIds = null;
}
}
public String getWho() {
return this.who;
}
public KillSessionsArgs setWho(String who) {
this.who = who;
return this;
}
public void unsetWho() {
this.who = null;
}
/** Returns true if field who is set (has been assigned a value) and false otherwise */
public boolean isSetWho() {
return this.who != null;
}
public void setWhoIsSet(boolean value) {
if (!value) {
this.who = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SESSION_IDS:
if (value == null) {
unsetSessionIds();
} else {
setSessionIds((List<String>)value);
}
break;
case WHO:
if (value == null) {
unsetWho();
} else {
setWho((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SESSION_IDS:
return getSessionIds();
case WHO:
return getWho();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SESSION_IDS:
return isSetSessionIds();
case WHO:
return isSetWho();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof KillSessionsArgs)
return this.equals((KillSessionsArgs)that);
return false;
}
public boolean equals(KillSessionsArgs that) {
if (that == null)
return false;
boolean this_present_sessionIds = true && this.isSetSessionIds();
boolean that_present_sessionIds = true && that.isSetSessionIds();
if (this_present_sessionIds || that_present_sessionIds) {
if (!(this_present_sessionIds && that_present_sessionIds))
return false;
if (!this.sessionIds.equals(that.sessionIds))
return false;
}
boolean this_present_who = true && this.isSetWho();
boolean that_present_who = true && that.isSetWho();
if (this_present_who || that_present_who) {
if (!(this_present_who && that_present_who))
return false;
if (!this.who.equals(that.who))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(KillSessionsArgs other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
KillSessionsArgs typedOther = (KillSessionsArgs)other;
lastComparison = Boolean.valueOf(isSetSessionIds()).compareTo(typedOther.isSetSessionIds());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSessionIds()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sessionIds, typedOther.sessionIds);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetWho()).compareTo(typedOther.isSetWho());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWho()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.who, typedOther.who);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (field.id) {
case 1: // SESSION_IDS
if (field.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list31 = iprot.readListBegin();
this.sessionIds = new ArrayList<String>(_list31.size);
for (int _i32 = 0; _i32 < _list31.size; ++_i32)
{
String _elem33; // required
_elem33 = iprot.readString();
this.sessionIds.add(_elem33);
}
iprot.readListEnd();
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // WHO
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.who = iprot.readString();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.sessionIds != null) {
oprot.writeFieldBegin(SESSION_IDS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.sessionIds.size()));
for (String _iter34 : this.sessionIds)
{
oprot.writeString(_iter34);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (this.who != null) {
oprot.writeFieldBegin(WHO_FIELD_DESC);
oprot.writeString(this.who);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("KillSessionsArgs(");
boolean first = true;
sb.append("sessionIds:");
if (this.sessionIds == null) {
sb.append("null");
} else {
sb.append(this.sessionIds);
}
first = false;
if (!first) sb.append(", ");
sb.append("who:");
if (this.who == null) {
sb.append("null");
} else {
sb.append(this.who);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (sessionIds == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'sessionIds' was not present! Struct: " + toString());
}
if (who == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'who' was not present! Struct: " + toString());
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
}