/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.yahoo.ycsb.db.tpcc.helper.rows;
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 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 WarehouseRow implements org.apache.thrift.TBase<WarehouseRow, WarehouseRow._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("WarehouseRow");
private static final org.apache.thrift.protocol.TField W_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("w_name", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField W_STREET_1_FIELD_DESC = new org.apache.thrift.protocol.TField("w_street_1", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField W_STREET_2_FIELD_DESC = new org.apache.thrift.protocol.TField("w_street_2", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField W_CITY_FIELD_DESC = new org.apache.thrift.protocol.TField("w_city", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField W_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("w_state", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField W_ZIP_FIELD_DESC = new org.apache.thrift.protocol.TField("w_zip", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final org.apache.thrift.protocol.TField W_TAX_FIELD_DESC = new org.apache.thrift.protocol.TField("w_tax", org.apache.thrift.protocol.TType.DOUBLE, (short)7);
private static final org.apache.thrift.protocol.TField W_YTD_FIELD_DESC = new org.apache.thrift.protocol.TField("w_ytd", org.apache.thrift.protocol.TType.DOUBLE, (short)8);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new WarehouseRowStandardSchemeFactory());
schemes.put(TupleScheme.class, new WarehouseRowTupleSchemeFactory());
}
public String w_name; // required
public String w_street_1; // required
public String w_street_2; // required
public String w_city; // required
public String w_state; // required
public String w_zip; // required
public double w_tax; // required
public double w_ytd; // 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 {
W_NAME((short)1, "w_name"),
W_STREET_1((short)2, "w_street_1"),
W_STREET_2((short)3, "w_street_2"),
W_CITY((short)4, "w_city"),
W_STATE((short)5, "w_state"),
W_ZIP((short)6, "w_zip"),
W_TAX((short)7, "w_tax"),
W_YTD((short)8, "w_ytd");
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: // W_NAME
return W_NAME;
case 2: // W_STREET_1
return W_STREET_1;
case 3: // W_STREET_2
return W_STREET_2;
case 4: // W_CITY
return W_CITY;
case 5: // W_STATE
return W_STATE;
case 6: // W_ZIP
return W_ZIP;
case 7: // W_TAX
return W_TAX;
case 8: // W_YTD
return W_YTD;
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 __W_TAX_ISSET_ID = 0;
private static final int __W_YTD_ISSET_ID = 1;
private byte __isset_bitfield = 0;
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.W_NAME, new org.apache.thrift.meta_data.FieldMetaData("w_name", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.W_STREET_1, new org.apache.thrift.meta_data.FieldMetaData("w_street_1", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.W_STREET_2, new org.apache.thrift.meta_data.FieldMetaData("w_street_2", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.W_CITY, new org.apache.thrift.meta_data.FieldMetaData("w_city", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.W_STATE, new org.apache.thrift.meta_data.FieldMetaData("w_state", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.W_ZIP, new org.apache.thrift.meta_data.FieldMetaData("w_zip", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.W_TAX, new org.apache.thrift.meta_data.FieldMetaData("w_tax", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.W_YTD, new org.apache.thrift.meta_data.FieldMetaData("w_ytd", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(WarehouseRow.class, metaDataMap);
}
public WarehouseRow() {
}
public WarehouseRow(
String w_name,
String w_street_1,
String w_street_2,
String w_city,
String w_state,
String w_zip,
double w_tax,
double w_ytd)
{
this();
this.w_name = w_name;
this.w_street_1 = w_street_1;
this.w_street_2 = w_street_2;
this.w_city = w_city;
this.w_state = w_state;
this.w_zip = w_zip;
this.w_tax = w_tax;
setW_taxIsSet(true);
this.w_ytd = w_ytd;
setW_ytdIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public WarehouseRow(WarehouseRow other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetW_name()) {
this.w_name = other.w_name;
}
if (other.isSetW_street_1()) {
this.w_street_1 = other.w_street_1;
}
if (other.isSetW_street_2()) {
this.w_street_2 = other.w_street_2;
}
if (other.isSetW_city()) {
this.w_city = other.w_city;
}
if (other.isSetW_state()) {
this.w_state = other.w_state;
}
if (other.isSetW_zip()) {
this.w_zip = other.w_zip;
}
this.w_tax = other.w_tax;
this.w_ytd = other.w_ytd;
}
public WarehouseRow deepCopy() {
return new WarehouseRow(this);
}
@Override
public void clear() {
this.w_name = null;
this.w_street_1 = null;
this.w_street_2 = null;
this.w_city = null;
this.w_state = null;
this.w_zip = null;
setW_taxIsSet(false);
this.w_tax = 0.0;
setW_ytdIsSet(false);
this.w_ytd = 0.0;
}
public String getW_name() {
return this.w_name;
}
public WarehouseRow setW_name(String w_name) {
this.w_name = w_name;
return this;
}
public void unsetW_name() {
this.w_name = null;
}
/** Returns true if field w_name is set (has been assigned a value) and false otherwise */
public boolean isSetW_name() {
return this.w_name != null;
}
public void setW_nameIsSet(boolean value) {
if (!value) {
this.w_name = null;
}
}
public String getW_street_1() {
return this.w_street_1;
}
public WarehouseRow setW_street_1(String w_street_1) {
this.w_street_1 = w_street_1;
return this;
}
public void unsetW_street_1() {
this.w_street_1 = null;
}
/** Returns true if field w_street_1 is set (has been assigned a value) and false otherwise */
public boolean isSetW_street_1() {
return this.w_street_1 != null;
}
public void setW_street_1IsSet(boolean value) {
if (!value) {
this.w_street_1 = null;
}
}
public String getW_street_2() {
return this.w_street_2;
}
public WarehouseRow setW_street_2(String w_street_2) {
this.w_street_2 = w_street_2;
return this;
}
public void unsetW_street_2() {
this.w_street_2 = null;
}
/** Returns true if field w_street_2 is set (has been assigned a value) and false otherwise */
public boolean isSetW_street_2() {
return this.w_street_2 != null;
}
public void setW_street_2IsSet(boolean value) {
if (!value) {
this.w_street_2 = null;
}
}
public String getW_city() {
return this.w_city;
}
public WarehouseRow setW_city(String w_city) {
this.w_city = w_city;
return this;
}
public void unsetW_city() {
this.w_city = null;
}
/** Returns true if field w_city is set (has been assigned a value) and false otherwise */
public boolean isSetW_city() {
return this.w_city != null;
}
public void setW_cityIsSet(boolean value) {
if (!value) {
this.w_city = null;
}
}
public String getW_state() {
return this.w_state;
}
public WarehouseRow setW_state(String w_state) {
this.w_state = w_state;
return this;
}
public void unsetW_state() {
this.w_state = null;
}
/** Returns true if field w_state is set (has been assigned a value) and false otherwise */
public boolean isSetW_state() {
return this.w_state != null;
}
public void setW_stateIsSet(boolean value) {
if (!value) {
this.w_state = null;
}
}
public String getW_zip() {
return this.w_zip;
}
public WarehouseRow setW_zip(String w_zip) {
this.w_zip = w_zip;
return this;
}
public void unsetW_zip() {
this.w_zip = null;
}
/** Returns true if field w_zip is set (has been assigned a value) and false otherwise */
public boolean isSetW_zip() {
return this.w_zip != null;
}
public void setW_zipIsSet(boolean value) {
if (!value) {
this.w_zip = null;
}
}
public double getW_tax() {
return this.w_tax;
}
public WarehouseRow setW_tax(double w_tax) {
this.w_tax = w_tax;
setW_taxIsSet(true);
return this;
}
public void unsetW_tax() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __W_TAX_ISSET_ID);
}
/** Returns true if field w_tax is set (has been assigned a value) and false otherwise */
public boolean isSetW_tax() {
return EncodingUtils.testBit(__isset_bitfield, __W_TAX_ISSET_ID);
}
public void setW_taxIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __W_TAX_ISSET_ID, value);
}
public double getW_ytd() {
return this.w_ytd;
}
public WarehouseRow setW_ytd(double w_ytd) {
this.w_ytd = w_ytd;
setW_ytdIsSet(true);
return this;
}
public void unsetW_ytd() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __W_YTD_ISSET_ID);
}
/** Returns true if field w_ytd is set (has been assigned a value) and false otherwise */
public boolean isSetW_ytd() {
return EncodingUtils.testBit(__isset_bitfield, __W_YTD_ISSET_ID);
}
public void setW_ytdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __W_YTD_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case W_NAME:
if (value == null) {
unsetW_name();
} else {
setW_name((String)value);
}
break;
case W_STREET_1:
if (value == null) {
unsetW_street_1();
} else {
setW_street_1((String)value);
}
break;
case W_STREET_2:
if (value == null) {
unsetW_street_2();
} else {
setW_street_2((String)value);
}
break;
case W_CITY:
if (value == null) {
unsetW_city();
} else {
setW_city((String)value);
}
break;
case W_STATE:
if (value == null) {
unsetW_state();
} else {
setW_state((String)value);
}
break;
case W_ZIP:
if (value == null) {
unsetW_zip();
} else {
setW_zip((String)value);
}
break;
case W_TAX:
if (value == null) {
unsetW_tax();
} else {
setW_tax((Double)value);
}
break;
case W_YTD:
if (value == null) {
unsetW_ytd();
} else {
setW_ytd((Double)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case W_NAME:
return getW_name();
case W_STREET_1:
return getW_street_1();
case W_STREET_2:
return getW_street_2();
case W_CITY:
return getW_city();
case W_STATE:
return getW_state();
case W_ZIP:
return getW_zip();
case W_TAX:
return Double.valueOf(getW_tax());
case W_YTD:
return Double.valueOf(getW_ytd());
}
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 W_NAME:
return isSetW_name();
case W_STREET_1:
return isSetW_street_1();
case W_STREET_2:
return isSetW_street_2();
case W_CITY:
return isSetW_city();
case W_STATE:
return isSetW_state();
case W_ZIP:
return isSetW_zip();
case W_TAX:
return isSetW_tax();
case W_YTD:
return isSetW_ytd();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof WarehouseRow)
return this.equals((WarehouseRow)that);
return false;
}
public boolean equals(WarehouseRow that) {
if (that == null)
return false;
boolean this_present_w_name = true && this.isSetW_name();
boolean that_present_w_name = true && that.isSetW_name();
if (this_present_w_name || that_present_w_name) {
if (!(this_present_w_name && that_present_w_name))
return false;
if (!this.w_name.equals(that.w_name))
return false;
}
boolean this_present_w_street_1 = true && this.isSetW_street_1();
boolean that_present_w_street_1 = true && that.isSetW_street_1();
if (this_present_w_street_1 || that_present_w_street_1) {
if (!(this_present_w_street_1 && that_present_w_street_1))
return false;
if (!this.w_street_1.equals(that.w_street_1))
return false;
}
boolean this_present_w_street_2 = true && this.isSetW_street_2();
boolean that_present_w_street_2 = true && that.isSetW_street_2();
if (this_present_w_street_2 || that_present_w_street_2) {
if (!(this_present_w_street_2 && that_present_w_street_2))
return false;
if (!this.w_street_2.equals(that.w_street_2))
return false;
}
boolean this_present_w_city = true && this.isSetW_city();
boolean that_present_w_city = true && that.isSetW_city();
if (this_present_w_city || that_present_w_city) {
if (!(this_present_w_city && that_present_w_city))
return false;
if (!this.w_city.equals(that.w_city))
return false;
}
boolean this_present_w_state = true && this.isSetW_state();
boolean that_present_w_state = true && that.isSetW_state();
if (this_present_w_state || that_present_w_state) {
if (!(this_present_w_state && that_present_w_state))
return false;
if (!this.w_state.equals(that.w_state))
return false;
}
boolean this_present_w_zip = true && this.isSetW_zip();
boolean that_present_w_zip = true && that.isSetW_zip();
if (this_present_w_zip || that_present_w_zip) {
if (!(this_present_w_zip && that_present_w_zip))
return false;
if (!this.w_zip.equals(that.w_zip))
return false;
}
boolean this_present_w_tax = true;
boolean that_present_w_tax = true;
if (this_present_w_tax || that_present_w_tax) {
if (!(this_present_w_tax && that_present_w_tax))
return false;
if (this.w_tax != that.w_tax)
return false;
}
boolean this_present_w_ytd = true;
boolean that_present_w_ytd = true;
if (this_present_w_ytd || that_present_w_ytd) {
if (!(this_present_w_ytd && that_present_w_ytd))
return false;
if (this.w_ytd != that.w_ytd)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(WarehouseRow other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
WarehouseRow typedOther = (WarehouseRow)other;
lastComparison = Boolean.valueOf(isSetW_name()).compareTo(typedOther.isSetW_name());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_name()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_name, typedOther.w_name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetW_street_1()).compareTo(typedOther.isSetW_street_1());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_street_1()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_street_1, typedOther.w_street_1);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetW_street_2()).compareTo(typedOther.isSetW_street_2());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_street_2()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_street_2, typedOther.w_street_2);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetW_city()).compareTo(typedOther.isSetW_city());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_city()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_city, typedOther.w_city);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetW_state()).compareTo(typedOther.isSetW_state());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_state()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_state, typedOther.w_state);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetW_zip()).compareTo(typedOther.isSetW_zip());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_zip()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_zip, typedOther.w_zip);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetW_tax()).compareTo(typedOther.isSetW_tax());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_tax()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_tax, typedOther.w_tax);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetW_ytd()).compareTo(typedOther.isSetW_ytd());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetW_ytd()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.w_ytd, typedOther.w_ytd);
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("WarehouseRow(");
boolean first = true;
sb.append("w_name:");
if (this.w_name == null) {
sb.append("null");
} else {
sb.append(this.w_name);
}
first = false;
if (!first) sb.append(", ");
sb.append("w_street_1:");
if (this.w_street_1 == null) {
sb.append("null");
} else {
sb.append(this.w_street_1);
}
first = false;
if (!first) sb.append(", ");
sb.append("w_street_2:");
if (this.w_street_2 == null) {
sb.append("null");
} else {
sb.append(this.w_street_2);
}
first = false;
if (!first) sb.append(", ");
sb.append("w_city:");
if (this.w_city == null) {
sb.append("null");
} else {
sb.append(this.w_city);
}
first = false;
if (!first) sb.append(", ");
sb.append("w_state:");
if (this.w_state == null) {
sb.append("null");
} else {
sb.append(this.w_state);
}
first = false;
if (!first) sb.append(", ");
sb.append("w_zip:");
if (this.w_zip == null) {
sb.append("null");
} else {
sb.append(this.w_zip);
}
first = false;
if (!first) sb.append(", ");
sb.append("w_tax:");
sb.append(this.w_tax);
first = false;
if (!first) sb.append(", ");
sb.append("w_ytd:");
sb.append(this.w_ytd);
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 WarehouseRowStandardSchemeFactory implements SchemeFactory {
public WarehouseRowStandardScheme getScheme() {
return new WarehouseRowStandardScheme();
}
}
private static class WarehouseRowStandardScheme extends StandardScheme<WarehouseRow> {
public void read(org.apache.thrift.protocol.TProtocol iprot, WarehouseRow 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: // W_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.w_name = iprot.readString();
struct.setW_nameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // W_STREET_1
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.w_street_1 = iprot.readString();
struct.setW_street_1IsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // W_STREET_2
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.w_street_2 = iprot.readString();
struct.setW_street_2IsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // W_CITY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.w_city = iprot.readString();
struct.setW_cityIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // W_STATE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.w_state = iprot.readString();
struct.setW_stateIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // W_ZIP
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.w_zip = iprot.readString();
struct.setW_zipIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // W_TAX
if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
struct.w_tax = iprot.readDouble();
struct.setW_taxIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // W_YTD
if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
struct.w_ytd = iprot.readDouble();
struct.setW_ytdIsSet(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, WarehouseRow struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.w_name != null) {
oprot.writeFieldBegin(W_NAME_FIELD_DESC);
oprot.writeString(struct.w_name);
oprot.writeFieldEnd();
}
if (struct.w_street_1 != null) {
oprot.writeFieldBegin(W_STREET_1_FIELD_DESC);
oprot.writeString(struct.w_street_1);
oprot.writeFieldEnd();
}
if (struct.w_street_2 != null) {
oprot.writeFieldBegin(W_STREET_2_FIELD_DESC);
oprot.writeString(struct.w_street_2);
oprot.writeFieldEnd();
}
if (struct.w_city != null) {
oprot.writeFieldBegin(W_CITY_FIELD_DESC);
oprot.writeString(struct.w_city);
oprot.writeFieldEnd();
}
if (struct.w_state != null) {
oprot.writeFieldBegin(W_STATE_FIELD_DESC);
oprot.writeString(struct.w_state);
oprot.writeFieldEnd();
}
if (struct.w_zip != null) {
oprot.writeFieldBegin(W_ZIP_FIELD_DESC);
oprot.writeString(struct.w_zip);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(W_TAX_FIELD_DESC);
oprot.writeDouble(struct.w_tax);
oprot.writeFieldEnd();
oprot.writeFieldBegin(W_YTD_FIELD_DESC);
oprot.writeDouble(struct.w_ytd);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class WarehouseRowTupleSchemeFactory implements SchemeFactory {
public WarehouseRowTupleScheme getScheme() {
return new WarehouseRowTupleScheme();
}
}
private static class WarehouseRowTupleScheme extends TupleScheme<WarehouseRow> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, WarehouseRow struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetW_name()) {
optionals.set(0);
}
if (struct.isSetW_street_1()) {
optionals.set(1);
}
if (struct.isSetW_street_2()) {
optionals.set(2);
}
if (struct.isSetW_city()) {
optionals.set(3);
}
if (struct.isSetW_state()) {
optionals.set(4);
}
if (struct.isSetW_zip()) {
optionals.set(5);
}
if (struct.isSetW_tax()) {
optionals.set(6);
}
if (struct.isSetW_ytd()) {
optionals.set(7);
}
oprot.writeBitSet(optionals, 8);
if (struct.isSetW_name()) {
oprot.writeString(struct.w_name);
}
if (struct.isSetW_street_1()) {
oprot.writeString(struct.w_street_1);
}
if (struct.isSetW_street_2()) {
oprot.writeString(struct.w_street_2);
}
if (struct.isSetW_city()) {
oprot.writeString(struct.w_city);
}
if (struct.isSetW_state()) {
oprot.writeString(struct.w_state);
}
if (struct.isSetW_zip()) {
oprot.writeString(struct.w_zip);
}
if (struct.isSetW_tax()) {
oprot.writeDouble(struct.w_tax);
}
if (struct.isSetW_ytd()) {
oprot.writeDouble(struct.w_ytd);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, WarehouseRow struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(8);
if (incoming.get(0)) {
struct.w_name = iprot.readString();
struct.setW_nameIsSet(true);
}
if (incoming.get(1)) {
struct.w_street_1 = iprot.readString();
struct.setW_street_1IsSet(true);
}
if (incoming.get(2)) {
struct.w_street_2 = iprot.readString();
struct.setW_street_2IsSet(true);
}
if (incoming.get(3)) {
struct.w_city = iprot.readString();
struct.setW_cityIsSet(true);
}
if (incoming.get(4)) {
struct.w_state = iprot.readString();
struct.setW_stateIsSet(true);
}
if (incoming.get(5)) {
struct.w_zip = iprot.readString();
struct.setW_zipIsSet(true);
}
if (incoming.get(6)) {
struct.w_tax = iprot.readDouble();
struct.setW_taxIsSet(true);
}
if (incoming.get(7)) {
struct.w_ytd = iprot.readDouble();
struct.setW_ytdIsSet(true);
}
}
}
}