/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.xiaomi.infra.galaxy.emr.thrift;
import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;
import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.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 javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2016-8-18")
public class BillItem implements libthrift091.TBase<BillItem, BillItem._Fields>, java.io.Serializable, Cloneable, Comparable<BillItem> {
private static final libthrift091.protocol.TStruct STRUCT_DESC = new libthrift091.protocol.TStruct("BillItem");
private static final libthrift091.protocol.TField NAME_FIELD_DESC = new libthrift091.protocol.TField("name", libthrift091.protocol.TType.STRING, (short)1);
private static final libthrift091.protocol.TField USAGE_FIELD_DESC = new libthrift091.protocol.TField("usage", libthrift091.protocol.TType.DOUBLE, (short)2);
private static final libthrift091.protocol.TField UNIT_COST_FIELD_DESC = new libthrift091.protocol.TField("unitCost", libthrift091.protocol.TType.DOUBLE, (short)3);
private static final libthrift091.protocol.TField UNIT_FIELD_DESC = new libthrift091.protocol.TField("unit", libthrift091.protocol.TType.STRING, (short)4);
private static final libthrift091.protocol.TField TOTAL_COST_FIELD_DESC = new libthrift091.protocol.TField("totalCost", libthrift091.protocol.TType.DOUBLE, (short)5);
private static final libthrift091.protocol.TField START_TIME_FIELD_DESC = new libthrift091.protocol.TField("startTime", libthrift091.protocol.TType.STRING, (short)6);
private static final libthrift091.protocol.TField END_TIME_FIELD_DESC = new libthrift091.protocol.TField("endTime", libthrift091.protocol.TType.STRING, (short)7);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new BillItemStandardSchemeFactory());
schemes.put(TupleScheme.class, new BillItemTupleSchemeFactory());
}
public String name; // required
public double usage; // required
public double unitCost; // required
public String unit; // required
public double totalCost; // required
public String startTime; // required
public String endTime; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements libthrift091.TFieldIdEnum {
NAME((short)1, "name"),
USAGE((short)2, "usage"),
UNIT_COST((short)3, "unitCost"),
UNIT((short)4, "unit"),
TOTAL_COST((short)5, "totalCost"),
START_TIME((short)6, "startTime"),
END_TIME((short)7, "endTime");
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: // NAME
return NAME;
case 2: // USAGE
return USAGE;
case 3: // UNIT_COST
return UNIT_COST;
case 4: // UNIT
return UNIT;
case 5: // TOTAL_COST
return TOTAL_COST;
case 6: // START_TIME
return START_TIME;
case 7: // END_TIME
return END_TIME;
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 __USAGE_ISSET_ID = 0;
private static final int __UNITCOST_ISSET_ID = 1;
private static final int __TOTALCOST_ISSET_ID = 2;
private byte __isset_bitfield = 0;
public static final Map<_Fields, libthrift091.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, libthrift091.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, libthrift091.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NAME, new libthrift091.meta_data.FieldMetaData("name", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.USAGE, new libthrift091.meta_data.FieldMetaData("usage", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.UNIT_COST, new libthrift091.meta_data.FieldMetaData("unitCost", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.UNIT, new libthrift091.meta_data.FieldMetaData("unit", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.TOTAL_COST, new libthrift091.meta_data.FieldMetaData("totalCost", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.DOUBLE)));
tmpMap.put(_Fields.START_TIME, new libthrift091.meta_data.FieldMetaData("startTime", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
tmpMap.put(_Fields.END_TIME, new libthrift091.meta_data.FieldMetaData("endTime", libthrift091.TFieldRequirementType.DEFAULT,
new libthrift091.meta_data.FieldValueMetaData(libthrift091.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
libthrift091.meta_data.FieldMetaData.addStructMetaDataMap(BillItem.class, metaDataMap);
}
public BillItem() {
}
public BillItem(
String name,
double usage,
double unitCost,
String unit,
double totalCost,
String startTime,
String endTime)
{
this();
this.name = name;
this.usage = usage;
setUsageIsSet(true);
this.unitCost = unitCost;
setUnitCostIsSet(true);
this.unit = unit;
this.totalCost = totalCost;
setTotalCostIsSet(true);
this.startTime = startTime;
this.endTime = endTime;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public BillItem(BillItem other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetName()) {
this.name = other.name;
}
this.usage = other.usage;
this.unitCost = other.unitCost;
if (other.isSetUnit()) {
this.unit = other.unit;
}
this.totalCost = other.totalCost;
if (other.isSetStartTime()) {
this.startTime = other.startTime;
}
if (other.isSetEndTime()) {
this.endTime = other.endTime;
}
}
public BillItem deepCopy() {
return new BillItem(this);
}
@Override
public void clear() {
this.name = null;
setUsageIsSet(false);
this.usage = 0.0;
setUnitCostIsSet(false);
this.unitCost = 0.0;
this.unit = null;
setTotalCostIsSet(false);
this.totalCost = 0.0;
this.startTime = null;
this.endTime = null;
}
public String getName() {
return this.name;
}
public BillItem setName(String name) {
this.name = name;
return this;
}
public void unsetName() {
this.name = null;
}
/** Returns true if field name is set (has been assigned a value) and false otherwise */
public boolean isSetName() {
return this.name != null;
}
public void setNameIsSet(boolean value) {
if (!value) {
this.name = null;
}
}
public double getUsage() {
return this.usage;
}
public BillItem setUsage(double usage) {
this.usage = usage;
setUsageIsSet(true);
return this;
}
public void unsetUsage() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __USAGE_ISSET_ID);
}
/** Returns true if field usage is set (has been assigned a value) and false otherwise */
public boolean isSetUsage() {
return EncodingUtils.testBit(__isset_bitfield, __USAGE_ISSET_ID);
}
public void setUsageIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __USAGE_ISSET_ID, value);
}
public double getUnitCost() {
return this.unitCost;
}
public BillItem setUnitCost(double unitCost) {
this.unitCost = unitCost;
setUnitCostIsSet(true);
return this;
}
public void unsetUnitCost() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __UNITCOST_ISSET_ID);
}
/** Returns true if field unitCost is set (has been assigned a value) and false otherwise */
public boolean isSetUnitCost() {
return EncodingUtils.testBit(__isset_bitfield, __UNITCOST_ISSET_ID);
}
public void setUnitCostIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UNITCOST_ISSET_ID, value);
}
public String getUnit() {
return this.unit;
}
public BillItem setUnit(String unit) {
this.unit = unit;
return this;
}
public void unsetUnit() {
this.unit = null;
}
/** Returns true if field unit is set (has been assigned a value) and false otherwise */
public boolean isSetUnit() {
return this.unit != null;
}
public void setUnitIsSet(boolean value) {
if (!value) {
this.unit = null;
}
}
public double getTotalCost() {
return this.totalCost;
}
public BillItem setTotalCost(double totalCost) {
this.totalCost = totalCost;
setTotalCostIsSet(true);
return this;
}
public void unsetTotalCost() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TOTALCOST_ISSET_ID);
}
/** Returns true if field totalCost is set (has been assigned a value) and false otherwise */
public boolean isSetTotalCost() {
return EncodingUtils.testBit(__isset_bitfield, __TOTALCOST_ISSET_ID);
}
public void setTotalCostIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TOTALCOST_ISSET_ID, value);
}
public String getStartTime() {
return this.startTime;
}
public BillItem setStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public void unsetStartTime() {
this.startTime = null;
}
/** Returns true if field startTime is set (has been assigned a value) and false otherwise */
public boolean isSetStartTime() {
return this.startTime != null;
}
public void setStartTimeIsSet(boolean value) {
if (!value) {
this.startTime = null;
}
}
public String getEndTime() {
return this.endTime;
}
public BillItem setEndTime(String endTime) {
this.endTime = endTime;
return this;
}
public void unsetEndTime() {
this.endTime = null;
}
/** Returns true if field endTime is set (has been assigned a value) and false otherwise */
public boolean isSetEndTime() {
return this.endTime != null;
}
public void setEndTimeIsSet(boolean value) {
if (!value) {
this.endTime = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NAME:
if (value == null) {
unsetName();
} else {
setName((String)value);
}
break;
case USAGE:
if (value == null) {
unsetUsage();
} else {
setUsage((Double)value);
}
break;
case UNIT_COST:
if (value == null) {
unsetUnitCost();
} else {
setUnitCost((Double)value);
}
break;
case UNIT:
if (value == null) {
unsetUnit();
} else {
setUnit((String)value);
}
break;
case TOTAL_COST:
if (value == null) {
unsetTotalCost();
} else {
setTotalCost((Double)value);
}
break;
case START_TIME:
if (value == null) {
unsetStartTime();
} else {
setStartTime((String)value);
}
break;
case END_TIME:
if (value == null) {
unsetEndTime();
} else {
setEndTime((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NAME:
return getName();
case USAGE:
return Double.valueOf(getUsage());
case UNIT_COST:
return Double.valueOf(getUnitCost());
case UNIT:
return getUnit();
case TOTAL_COST:
return Double.valueOf(getTotalCost());
case START_TIME:
return getStartTime();
case END_TIME:
return getEndTime();
}
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 NAME:
return isSetName();
case USAGE:
return isSetUsage();
case UNIT_COST:
return isSetUnitCost();
case UNIT:
return isSetUnit();
case TOTAL_COST:
return isSetTotalCost();
case START_TIME:
return isSetStartTime();
case END_TIME:
return isSetEndTime();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof BillItem)
return this.equals((BillItem)that);
return false;
}
public boolean equals(BillItem that) {
if (that == null)
return false;
boolean this_present_name = true && this.isSetName();
boolean that_present_name = true && that.isSetName();
if (this_present_name || that_present_name) {
if (!(this_present_name && that_present_name))
return false;
if (!this.name.equals(that.name))
return false;
}
boolean this_present_usage = true;
boolean that_present_usage = true;
if (this_present_usage || that_present_usage) {
if (!(this_present_usage && that_present_usage))
return false;
if (this.usage != that.usage)
return false;
}
boolean this_present_unitCost = true;
boolean that_present_unitCost = true;
if (this_present_unitCost || that_present_unitCost) {
if (!(this_present_unitCost && that_present_unitCost))
return false;
if (this.unitCost != that.unitCost)
return false;
}
boolean this_present_unit = true && this.isSetUnit();
boolean that_present_unit = true && that.isSetUnit();
if (this_present_unit || that_present_unit) {
if (!(this_present_unit && that_present_unit))
return false;
if (!this.unit.equals(that.unit))
return false;
}
boolean this_present_totalCost = true;
boolean that_present_totalCost = true;
if (this_present_totalCost || that_present_totalCost) {
if (!(this_present_totalCost && that_present_totalCost))
return false;
if (this.totalCost != that.totalCost)
return false;
}
boolean this_present_startTime = true && this.isSetStartTime();
boolean that_present_startTime = true && that.isSetStartTime();
if (this_present_startTime || that_present_startTime) {
if (!(this_present_startTime && that_present_startTime))
return false;
if (!this.startTime.equals(that.startTime))
return false;
}
boolean this_present_endTime = true && this.isSetEndTime();
boolean that_present_endTime = true && that.isSetEndTime();
if (this_present_endTime || that_present_endTime) {
if (!(this_present_endTime && that_present_endTime))
return false;
if (!this.endTime.equals(that.endTime))
return false;
}
return true;
}
@Override
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_name = true && (isSetName());
list.add(present_name);
if (present_name)
list.add(name);
boolean present_usage = true;
list.add(present_usage);
if (present_usage)
list.add(usage);
boolean present_unitCost = true;
list.add(present_unitCost);
if (present_unitCost)
list.add(unitCost);
boolean present_unit = true && (isSetUnit());
list.add(present_unit);
if (present_unit)
list.add(unit);
boolean present_totalCost = true;
list.add(present_totalCost);
if (present_totalCost)
list.add(totalCost);
boolean present_startTime = true && (isSetStartTime());
list.add(present_startTime);
if (present_startTime)
list.add(startTime);
boolean present_endTime = true && (isSetEndTime());
list.add(present_endTime);
if (present_endTime)
list.add(endTime);
return list.hashCode();
}
@Override
public int compareTo(BillItem other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetName()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.name, other.name);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUsage()).compareTo(other.isSetUsage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUsage()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.usage, other.usage);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUnitCost()).compareTo(other.isSetUnitCost());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUnitCost()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.unitCost, other.unitCost);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUnit()).compareTo(other.isSetUnit());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUnit()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.unit, other.unit);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTotalCost()).compareTo(other.isSetTotalCost());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTotalCost()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.totalCost, other.totalCost);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetStartTime()).compareTo(other.isSetStartTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStartTime()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.startTime, other.startTime);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetEndTime()).compareTo(other.isSetEndTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEndTime()) {
lastComparison = libthrift091.TBaseHelper.compareTo(this.endTime, other.endTime);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(libthrift091.protocol.TProtocol iprot) throws libthrift091.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(libthrift091.protocol.TProtocol oprot) throws libthrift091.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("BillItem(");
boolean first = true;
sb.append("name:");
if (this.name == null) {
sb.append("null");
} else {
sb.append(this.name);
}
first = false;
if (!first) sb.append(", ");
sb.append("usage:");
sb.append(this.usage);
first = false;
if (!first) sb.append(", ");
sb.append("unitCost:");
sb.append(this.unitCost);
first = false;
if (!first) sb.append(", ");
sb.append("unit:");
if (this.unit == null) {
sb.append("null");
} else {
sb.append(this.unit);
}
first = false;
if (!first) sb.append(", ");
sb.append("totalCost:");
sb.append(this.totalCost);
first = false;
if (!first) sb.append(", ");
sb.append("startTime:");
if (this.startTime == null) {
sb.append("null");
} else {
sb.append(this.startTime);
}
first = false;
if (!first) sb.append(", ");
sb.append("endTime:");
if (this.endTime == null) {
sb.append("null");
} else {
sb.append(this.endTime);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws libthrift091.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(out)));
} catch (libthrift091.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 libthrift091.protocol.TCompactProtocol(new libthrift091.transport.TIOStreamTransport(in)));
} catch (libthrift091.TException te) {
throw new java.io.IOException(te);
}
}
private static class BillItemStandardSchemeFactory implements SchemeFactory {
public BillItemStandardScheme getScheme() {
return new BillItemStandardScheme();
}
}
private static class BillItemStandardScheme extends StandardScheme<BillItem> {
public void read(libthrift091.protocol.TProtocol iprot, BillItem struct) throws libthrift091.TException {
libthrift091.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == libthrift091.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // NAME
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // USAGE
if (schemeField.type == libthrift091.protocol.TType.DOUBLE) {
struct.usage = iprot.readDouble();
struct.setUsageIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // UNIT_COST
if (schemeField.type == libthrift091.protocol.TType.DOUBLE) {
struct.unitCost = iprot.readDouble();
struct.setUnitCostIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // UNIT
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.unit = iprot.readString();
struct.setUnitIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // TOTAL_COST
if (schemeField.type == libthrift091.protocol.TType.DOUBLE) {
struct.totalCost = iprot.readDouble();
struct.setTotalCostIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // START_TIME
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.startTime = iprot.readString();
struct.setStartTimeIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // END_TIME
if (schemeField.type == libthrift091.protocol.TType.STRING) {
struct.endTime = iprot.readString();
struct.setEndTimeIsSet(true);
} else {
libthrift091.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
libthrift091.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(libthrift091.protocol.TProtocol oprot, BillItem struct) throws libthrift091.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.name != null) {
oprot.writeFieldBegin(NAME_FIELD_DESC);
oprot.writeString(struct.name);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(USAGE_FIELD_DESC);
oprot.writeDouble(struct.usage);
oprot.writeFieldEnd();
oprot.writeFieldBegin(UNIT_COST_FIELD_DESC);
oprot.writeDouble(struct.unitCost);
oprot.writeFieldEnd();
if (struct.unit != null) {
oprot.writeFieldBegin(UNIT_FIELD_DESC);
oprot.writeString(struct.unit);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(TOTAL_COST_FIELD_DESC);
oprot.writeDouble(struct.totalCost);
oprot.writeFieldEnd();
if (struct.startTime != null) {
oprot.writeFieldBegin(START_TIME_FIELD_DESC);
oprot.writeString(struct.startTime);
oprot.writeFieldEnd();
}
if (struct.endTime != null) {
oprot.writeFieldBegin(END_TIME_FIELD_DESC);
oprot.writeString(struct.endTime);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class BillItemTupleSchemeFactory implements SchemeFactory {
public BillItemTupleScheme getScheme() {
return new BillItemTupleScheme();
}
}
private static class BillItemTupleScheme extends TupleScheme<BillItem> {
@Override
public void write(libthrift091.protocol.TProtocol prot, BillItem struct) throws libthrift091.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetName()) {
optionals.set(0);
}
if (struct.isSetUsage()) {
optionals.set(1);
}
if (struct.isSetUnitCost()) {
optionals.set(2);
}
if (struct.isSetUnit()) {
optionals.set(3);
}
if (struct.isSetTotalCost()) {
optionals.set(4);
}
if (struct.isSetStartTime()) {
optionals.set(5);
}
if (struct.isSetEndTime()) {
optionals.set(6);
}
oprot.writeBitSet(optionals, 7);
if (struct.isSetName()) {
oprot.writeString(struct.name);
}
if (struct.isSetUsage()) {
oprot.writeDouble(struct.usage);
}
if (struct.isSetUnitCost()) {
oprot.writeDouble(struct.unitCost);
}
if (struct.isSetUnit()) {
oprot.writeString(struct.unit);
}
if (struct.isSetTotalCost()) {
oprot.writeDouble(struct.totalCost);
}
if (struct.isSetStartTime()) {
oprot.writeString(struct.startTime);
}
if (struct.isSetEndTime()) {
oprot.writeString(struct.endTime);
}
}
@Override
public void read(libthrift091.protocol.TProtocol prot, BillItem struct) throws libthrift091.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(7);
if (incoming.get(0)) {
struct.name = iprot.readString();
struct.setNameIsSet(true);
}
if (incoming.get(1)) {
struct.usage = iprot.readDouble();
struct.setUsageIsSet(true);
}
if (incoming.get(2)) {
struct.unitCost = iprot.readDouble();
struct.setUnitCostIsSet(true);
}
if (incoming.get(3)) {
struct.unit = iprot.readString();
struct.setUnitIsSet(true);
}
if (incoming.get(4)) {
struct.totalCost = iprot.readDouble();
struct.setTotalCostIsSet(true);
}
if (incoming.get(5)) {
struct.startTime = iprot.readString();
struct.setStartTimeIsSet(true);
}
if (incoming.get(6)) {
struct.endTime = iprot.readString();
struct.setEndTimeIsSet(true);
}
}
}
}