/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package ch.usi.da.dmap.thrift.gen;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
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 RangeCommand implements org.apache.thrift.TBase<RangeCommand, RangeCommand._Fields>, java.io.Serializable, Cloneable, Comparable<RangeCommand> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RangeCommand");
private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1);
private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField FROMKEY_FIELD_DESC = new org.apache.thrift.protocol.TField("fromkey", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField TOKEY_FIELD_DESC = new org.apache.thrift.protocol.TField("tokey", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField FROMID_FIELD_DESC = new org.apache.thrift.protocol.TField("fromid", org.apache.thrift.protocol.TType.I32, (short)5);
private static final org.apache.thrift.protocol.TField TOID_FIELD_DESC = new org.apache.thrift.protocol.TField("toid", org.apache.thrift.protocol.TType.I32, (short)6);
private static final org.apache.thrift.protocol.TField SNAPSHOT_FIELD_DESC = new org.apache.thrift.protocol.TField("snapshot", org.apache.thrift.protocol.TType.I64, (short)7);
private static final org.apache.thrift.protocol.TField PARTITION_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("partition_version", org.apache.thrift.protocol.TType.I64, (short)8);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new RangeCommandStandardSchemeFactory());
schemes.put(TupleScheme.class, new RangeCommandTupleSchemeFactory());
}
public long id; // required
/**
*
* @see RangeType
*/
public RangeType type; // required
public ByteBuffer fromkey; // optional
public ByteBuffer tokey; // optional
public int fromid; // optional
public int toid; // optional
public long snapshot; // optional
public long partition_version; // 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 {
ID((short)1, "id"),
/**
*
* @see RangeType
*/
TYPE((short)2, "type"),
FROMKEY((short)3, "fromkey"),
TOKEY((short)4, "tokey"),
FROMID((short)5, "fromid"),
TOID((short)6, "toid"),
SNAPSHOT((short)7, "snapshot"),
PARTITION_VERSION((short)8, "partition_version");
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: // ID
return ID;
case 2: // TYPE
return TYPE;
case 3: // FROMKEY
return FROMKEY;
case 4: // TOKEY
return TOKEY;
case 5: // FROMID
return FROMID;
case 6: // TOID
return TOID;
case 7: // SNAPSHOT
return SNAPSHOT;
case 8: // PARTITION_VERSION
return PARTITION_VERSION;
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
private static final int __ID_ISSET_ID = 0;
private static final int __FROMID_ISSET_ID = 1;
private static final int __TOID_ISSET_ID = 2;
private static final int __SNAPSHOT_ISSET_ID = 3;
private static final int __PARTITION_VERSION_ISSET_ID = 4;
private byte __isset_bitfield = 0;
private _Fields optionals[] = {_Fields.FROMKEY,_Fields.TOKEY,_Fields.FROMID,_Fields.TOID,_Fields.SNAPSHOT};
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.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, RangeType.class)));
tmpMap.put(_Fields.FROMKEY, new org.apache.thrift.meta_data.FieldMetaData("fromkey", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.TOKEY, new org.apache.thrift.meta_data.FieldMetaData("tokey", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)));
tmpMap.put(_Fields.FROMID, new org.apache.thrift.meta_data.FieldMetaData("fromid", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.TOID, new org.apache.thrift.meta_data.FieldMetaData("toid", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.SNAPSHOT, new org.apache.thrift.meta_data.FieldMetaData("snapshot", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.PARTITION_VERSION, new org.apache.thrift.meta_data.FieldMetaData("partition_version", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(RangeCommand.class, metaDataMap);
}
public RangeCommand() {
}
public RangeCommand(
long id,
RangeType type,
long partition_version)
{
this();
this.id = id;
setIdIsSet(true);
this.type = type;
this.partition_version = partition_version;
setPartition_versionIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public RangeCommand(RangeCommand other) {
__isset_bitfield = other.__isset_bitfield;
this.id = other.id;
if (other.isSetType()) {
this.type = other.type;
}
if (other.isSetFromkey()) {
this.fromkey = org.apache.thrift.TBaseHelper.copyBinary(other.fromkey);
;
}
if (other.isSetTokey()) {
this.tokey = org.apache.thrift.TBaseHelper.copyBinary(other.tokey);
;
}
this.fromid = other.fromid;
this.toid = other.toid;
this.snapshot = other.snapshot;
this.partition_version = other.partition_version;
}
public RangeCommand deepCopy() {
return new RangeCommand(this);
}
@Override
public void clear() {
setIdIsSet(false);
this.id = 0;
this.type = null;
this.fromkey = null;
this.tokey = null;
setFromidIsSet(false);
this.fromid = 0;
setToidIsSet(false);
this.toid = 0;
setSnapshotIsSet(false);
this.snapshot = 0;
setPartition_versionIsSet(false);
this.partition_version = 0;
}
public long getId() {
return this.id;
}
public RangeCommand setId(long id) {
this.id = id;
setIdIsSet(true);
return this;
}
public void unsetId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
}
/** Returns true if field id is set (has been assigned a value) and false otherwise */
public boolean isSetId() {
return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
}
public void setIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
}
/**
*
* @see RangeType
*/
public RangeType getType() {
return this.type;
}
/**
*
* @see RangeType
*/
public RangeCommand setType(RangeType type) {
this.type = type;
return this;
}
public void unsetType() {
this.type = null;
}
/** Returns true if field type is set (has been assigned a value) and false otherwise */
public boolean isSetType() {
return this.type != null;
}
public void setTypeIsSet(boolean value) {
if (!value) {
this.type = null;
}
}
public byte[] getFromkey() {
setFromkey(org.apache.thrift.TBaseHelper.rightSize(fromkey));
return fromkey == null ? null : fromkey.array();
}
public ByteBuffer bufferForFromkey() {
return fromkey;
}
public RangeCommand setFromkey(byte[] fromkey) {
setFromkey(fromkey == null ? (ByteBuffer)null : ByteBuffer.wrap(fromkey));
return this;
}
public RangeCommand setFromkey(ByteBuffer fromkey) {
this.fromkey = fromkey;
return this;
}
public void unsetFromkey() {
this.fromkey = null;
}
/** Returns true if field fromkey is set (has been assigned a value) and false otherwise */
public boolean isSetFromkey() {
return this.fromkey != null;
}
public void setFromkeyIsSet(boolean value) {
if (!value) {
this.fromkey = null;
}
}
public byte[] getTokey() {
setTokey(org.apache.thrift.TBaseHelper.rightSize(tokey));
return tokey == null ? null : tokey.array();
}
public ByteBuffer bufferForTokey() {
return tokey;
}
public RangeCommand setTokey(byte[] tokey) {
setTokey(tokey == null ? (ByteBuffer)null : ByteBuffer.wrap(tokey));
return this;
}
public RangeCommand setTokey(ByteBuffer tokey) {
this.tokey = tokey;
return this;
}
public void unsetTokey() {
this.tokey = null;
}
/** Returns true if field tokey is set (has been assigned a value) and false otherwise */
public boolean isSetTokey() {
return this.tokey != null;
}
public void setTokeyIsSet(boolean value) {
if (!value) {
this.tokey = null;
}
}
public int getFromid() {
return this.fromid;
}
public RangeCommand setFromid(int fromid) {
this.fromid = fromid;
setFromidIsSet(true);
return this;
}
public void unsetFromid() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FROMID_ISSET_ID);
}
/** Returns true if field fromid is set (has been assigned a value) and false otherwise */
public boolean isSetFromid() {
return EncodingUtils.testBit(__isset_bitfield, __FROMID_ISSET_ID);
}
public void setFromidIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FROMID_ISSET_ID, value);
}
public int getToid() {
return this.toid;
}
public RangeCommand setToid(int toid) {
this.toid = toid;
setToidIsSet(true);
return this;
}
public void unsetToid() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TOID_ISSET_ID);
}
/** Returns true if field toid is set (has been assigned a value) and false otherwise */
public boolean isSetToid() {
return EncodingUtils.testBit(__isset_bitfield, __TOID_ISSET_ID);
}
public void setToidIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOID_ISSET_ID, value);
}
public long getSnapshot() {
return this.snapshot;
}
public RangeCommand setSnapshot(long snapshot) {
this.snapshot = snapshot;
setSnapshotIsSet(true);
return this;
}
public void unsetSnapshot() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SNAPSHOT_ISSET_ID);
}
/** Returns true if field snapshot is set (has been assigned a value) and false otherwise */
public boolean isSetSnapshot() {
return EncodingUtils.testBit(__isset_bitfield, __SNAPSHOT_ISSET_ID);
}
public void setSnapshotIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SNAPSHOT_ISSET_ID, value);
}
public long getPartition_version() {
return this.partition_version;
}
public RangeCommand setPartition_version(long partition_version) {
this.partition_version = partition_version;
setPartition_versionIsSet(true);
return this;
}
public void unsetPartition_version() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __PARTITION_VERSION_ISSET_ID);
}
/** Returns true if field partition_version is set (has been assigned a value) and false otherwise */
public boolean isSetPartition_version() {
return EncodingUtils.testBit(__isset_bitfield, __PARTITION_VERSION_ISSET_ID);
}
public void setPartition_versionIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __PARTITION_VERSION_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ID:
if (value == null) {
unsetId();
} else {
setId((Long)value);
}
break;
case TYPE:
if (value == null) {
unsetType();
} else {
setType((RangeType)value);
}
break;
case FROMKEY:
if (value == null) {
unsetFromkey();
} else {
setFromkey((ByteBuffer)value);
}
break;
case TOKEY:
if (value == null) {
unsetTokey();
} else {
setTokey((ByteBuffer)value);
}
break;
case FROMID:
if (value == null) {
unsetFromid();
} else {
setFromid((Integer)value);
}
break;
case TOID:
if (value == null) {
unsetToid();
} else {
setToid((Integer)value);
}
break;
case SNAPSHOT:
if (value == null) {
unsetSnapshot();
} else {
setSnapshot((Long)value);
}
break;
case PARTITION_VERSION:
if (value == null) {
unsetPartition_version();
} else {
setPartition_version((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ID:
return Long.valueOf(getId());
case TYPE:
return getType();
case FROMKEY:
return getFromkey();
case TOKEY:
return getTokey();
case FROMID:
return Integer.valueOf(getFromid());
case TOID:
return Integer.valueOf(getToid());
case SNAPSHOT:
return Long.valueOf(getSnapshot());
case PARTITION_VERSION:
return Long.valueOf(getPartition_version());
}
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 ID:
return isSetId();
case TYPE:
return isSetType();
case FROMKEY:
return isSetFromkey();
case TOKEY:
return isSetTokey();
case FROMID:
return isSetFromid();
case TOID:
return isSetToid();
case SNAPSHOT:
return isSetSnapshot();
case PARTITION_VERSION:
return isSetPartition_version();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof RangeCommand)
return this.equals((RangeCommand)that);
return false;
}
public boolean equals(RangeCommand that) {
if (that == null)
return false;
boolean this_present_id = true;
boolean that_present_id = true;
if (this_present_id || that_present_id) {
if (!(this_present_id && that_present_id))
return false;
if (this.id != that.id)
return false;
}
boolean this_present_type = true && this.isSetType();
boolean that_present_type = true && that.isSetType();
if (this_present_type || that_present_type) {
if (!(this_present_type && that_present_type))
return false;
if (!this.type.equals(that.type))
return false;
}
boolean this_present_fromkey = true && this.isSetFromkey();
boolean that_present_fromkey = true && that.isSetFromkey();
if (this_present_fromkey || that_present_fromkey) {
if (!(this_present_fromkey && that_present_fromkey))
return false;
if (!this.fromkey.equals(that.fromkey))
return false;
}
boolean this_present_tokey = true && this.isSetTokey();
boolean that_present_tokey = true && that.isSetTokey();
if (this_present_tokey || that_present_tokey) {
if (!(this_present_tokey && that_present_tokey))
return false;
if (!this.tokey.equals(that.tokey))
return false;
}
boolean this_present_fromid = true && this.isSetFromid();
boolean that_present_fromid = true && that.isSetFromid();
if (this_present_fromid || that_present_fromid) {
if (!(this_present_fromid && that_present_fromid))
return false;
if (this.fromid != that.fromid)
return false;
}
boolean this_present_toid = true && this.isSetToid();
boolean that_present_toid = true && that.isSetToid();
if (this_present_toid || that_present_toid) {
if (!(this_present_toid && that_present_toid))
return false;
if (this.toid != that.toid)
return false;
}
boolean this_present_snapshot = true && this.isSetSnapshot();
boolean that_present_snapshot = true && that.isSetSnapshot();
if (this_present_snapshot || that_present_snapshot) {
if (!(this_present_snapshot && that_present_snapshot))
return false;
if (this.snapshot != that.snapshot)
return false;
}
boolean this_present_partition_version = true;
boolean that_present_partition_version = true;
if (this_present_partition_version || that_present_partition_version) {
if (!(this_present_partition_version && that_present_partition_version))
return false;
if (this.partition_version != that.partition_version)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public int compareTo(RangeCommand other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetFromkey()).compareTo(other.isSetFromkey());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFromkey()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fromkey, other.fromkey);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTokey()).compareTo(other.isSetTokey());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTokey()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tokey, other.tokey);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetFromid()).compareTo(other.isSetFromid());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetFromid()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fromid, other.fromid);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetToid()).compareTo(other.isSetToid());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetToid()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.toid, other.toid);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSnapshot()).compareTo(other.isSetSnapshot());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSnapshot()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.snapshot, other.snapshot);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPartition_version()).compareTo(other.isSetPartition_version());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPartition_version()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partition_version, other.partition_version);
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 {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("RangeCommand(");
boolean first = true;
sb.append("id:");
sb.append(this.id);
first = false;
if (!first) sb.append(", ");
sb.append("type:");
if (this.type == null) {
sb.append("null");
} else {
sb.append(this.type);
}
first = false;
if (isSetFromkey()) {
if (!first) sb.append(", ");
sb.append("fromkey:");
if (this.fromkey == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.fromkey, sb);
}
first = false;
}
if (isSetTokey()) {
if (!first) sb.append(", ");
sb.append("tokey:");
if (this.tokey == null) {
sb.append("null");
} else {
org.apache.thrift.TBaseHelper.toString(this.tokey, sb);
}
first = false;
}
if (isSetFromid()) {
if (!first) sb.append(", ");
sb.append("fromid:");
sb.append(this.fromid);
first = false;
}
if (isSetToid()) {
if (!first) sb.append(", ");
sb.append("toid:");
sb.append(this.toid);
first = false;
}
if (isSetSnapshot()) {
if (!first) sb.append(", ");
sb.append("snapshot:");
sb.append(this.snapshot);
first = false;
}
if (!first) sb.append(", ");
sb.append("partition_version:");
sb.append(this.partition_version);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
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 {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
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);
}
}
private static class RangeCommandStandardSchemeFactory implements SchemeFactory {
public RangeCommandStandardScheme getScheme() {
return new RangeCommandStandardScheme();
}
}
private static class RangeCommandStandardScheme extends StandardScheme<RangeCommand> {
public void read(org.apache.thrift.protocol.TProtocol iprot, RangeCommand struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.id = iprot.readI64();
struct.setIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.type = RangeType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // FROMKEY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.fromkey = iprot.readBinary();
struct.setFromkeyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // TOKEY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.tokey = iprot.readBinary();
struct.setTokeyIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // FROMID
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.fromid = iprot.readI32();
struct.setFromidIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // TOID
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.toid = iprot.readI32();
struct.setToidIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // SNAPSHOT
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.snapshot = iprot.readI64();
struct.setSnapshotIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // PARTITION_VERSION
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.partition_version = iprot.readI64();
struct.setPartition_versionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, RangeCommand struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(ID_FIELD_DESC);
oprot.writeI64(struct.id);
oprot.writeFieldEnd();
if (struct.type != null) {
oprot.writeFieldBegin(TYPE_FIELD_DESC);
oprot.writeI32(struct.type.getValue());
oprot.writeFieldEnd();
}
if (struct.fromkey != null) {
if (struct.isSetFromkey()) {
oprot.writeFieldBegin(FROMKEY_FIELD_DESC);
oprot.writeBinary(struct.fromkey);
oprot.writeFieldEnd();
}
}
if (struct.tokey != null) {
if (struct.isSetTokey()) {
oprot.writeFieldBegin(TOKEY_FIELD_DESC);
oprot.writeBinary(struct.tokey);
oprot.writeFieldEnd();
}
}
if (struct.isSetFromid()) {
oprot.writeFieldBegin(FROMID_FIELD_DESC);
oprot.writeI32(struct.fromid);
oprot.writeFieldEnd();
}
if (struct.isSetToid()) {
oprot.writeFieldBegin(TOID_FIELD_DESC);
oprot.writeI32(struct.toid);
oprot.writeFieldEnd();
}
if (struct.isSetSnapshot()) {
oprot.writeFieldBegin(SNAPSHOT_FIELD_DESC);
oprot.writeI64(struct.snapshot);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(PARTITION_VERSION_FIELD_DESC);
oprot.writeI64(struct.partition_version);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class RangeCommandTupleSchemeFactory implements SchemeFactory {
public RangeCommandTupleScheme getScheme() {
return new RangeCommandTupleScheme();
}
}
private static class RangeCommandTupleScheme extends TupleScheme<RangeCommand> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, RangeCommand struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetId()) {
optionals.set(0);
}
if (struct.isSetType()) {
optionals.set(1);
}
if (struct.isSetFromkey()) {
optionals.set(2);
}
if (struct.isSetTokey()) {
optionals.set(3);
}
if (struct.isSetFromid()) {
optionals.set(4);
}
if (struct.isSetToid()) {
optionals.set(5);
}
if (struct.isSetSnapshot()) {
optionals.set(6);
}
if (struct.isSetPartition_version()) {
optionals.set(7);
}
oprot.writeBitSet(optionals, 8);
if (struct.isSetId()) {
oprot.writeI64(struct.id);
}
if (struct.isSetType()) {
oprot.writeI32(struct.type.getValue());
}
if (struct.isSetFromkey()) {
oprot.writeBinary(struct.fromkey);
}
if (struct.isSetTokey()) {
oprot.writeBinary(struct.tokey);
}
if (struct.isSetFromid()) {
oprot.writeI32(struct.fromid);
}
if (struct.isSetToid()) {
oprot.writeI32(struct.toid);
}
if (struct.isSetSnapshot()) {
oprot.writeI64(struct.snapshot);
}
if (struct.isSetPartition_version()) {
oprot.writeI64(struct.partition_version);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, RangeCommand struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(8);
if (incoming.get(0)) {
struct.id = iprot.readI64();
struct.setIdIsSet(true);
}
if (incoming.get(1)) {
struct.type = RangeType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
}
if (incoming.get(2)) {
struct.fromkey = iprot.readBinary();
struct.setFromkeyIsSet(true);
}
if (incoming.get(3)) {
struct.tokey = iprot.readBinary();
struct.setTokeyIsSet(true);
}
if (incoming.get(4)) {
struct.fromid = iprot.readI32();
struct.setFromidIsSet(true);
}
if (incoming.get(5)) {
struct.toid = iprot.readI32();
struct.setToidIsSet(true);
}
if (incoming.get(6)) {
struct.snapshot = iprot.readI64();
struct.setSnapshotIsSet(true);
}
if (incoming.get(7)) {
struct.partition_version = iprot.readI64();
struct.setPartition_versionIsSet(true);
}
}
}
}