/** * Autogenerated by Thrift Compiler (0.9.2) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package edu.berkeley.cs.amplab.carat.thrift; import java.util.ArrayList; import java.util.BitSet; import java.util.Collections; import java.util.EnumMap; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Generated; import org.apache.thrift.EncodingUtils; import org.apache.thrift.protocol.TTupleProtocol; 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 android.annotation.SuppressLint; @SuppressLint("NewApi") @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2014-12-19") public class BatteryDetails implements org.apache.thrift.TBase<BatteryDetails, BatteryDetails._Fields>, java.io.Serializable, Cloneable, Comparable<BatteryDetails> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BatteryDetails"); private static final org.apache.thrift.protocol.TField BATTERY_CHARGER_FIELD_DESC = new org.apache.thrift.protocol.TField("batteryCharger", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField BATTERY_HEALTH_FIELD_DESC = new org.apache.thrift.protocol.TField("batteryHealth", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField BATTERY_VOLTAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("batteryVoltage", org.apache.thrift.protocol.TType.DOUBLE, (short)3); private static final org.apache.thrift.protocol.TField BATTERY_TEMPERATURE_FIELD_DESC = new org.apache.thrift.protocol.TField("batteryTemperature", org.apache.thrift.protocol.TType.DOUBLE, (short)4); private static final org.apache.thrift.protocol.TField BATTERY_TECHNOLOGY_FIELD_DESC = new org.apache.thrift.protocol.TField("batteryTechnology", org.apache.thrift.protocol.TType.STRING, (short)5); private static final org.apache.thrift.protocol.TField BATTERY_CAPACITY_FIELD_DESC = new org.apache.thrift.protocol.TField("batteryCapacity", org.apache.thrift.protocol.TType.DOUBLE, (short)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new BatteryDetailsStandardSchemeFactory()); schemes.put(TupleScheme.class, new BatteryDetailsTupleSchemeFactory()); } public String batteryCharger; // optional public String batteryHealth; // optional public double batteryVoltage; // optional public double batteryTemperature; // optional public String batteryTechnology; // optional public double batteryCapacity; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { BATTERY_CHARGER((short)1, "batteryCharger"), BATTERY_HEALTH((short)2, "batteryHealth"), BATTERY_VOLTAGE((short)3, "batteryVoltage"), BATTERY_TEMPERATURE((short)4, "batteryTemperature"), BATTERY_TECHNOLOGY((short)5, "batteryTechnology"), BATTERY_CAPACITY((short)6, "batteryCapacity"); 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: // BATTERY_CHARGER return BATTERY_CHARGER; case 2: // BATTERY_HEALTH return BATTERY_HEALTH; case 3: // BATTERY_VOLTAGE return BATTERY_VOLTAGE; case 4: // BATTERY_TEMPERATURE return BATTERY_TEMPERATURE; case 5: // BATTERY_TECHNOLOGY return BATTERY_TECHNOLOGY; case 6: // BATTERY_CAPACITY return BATTERY_CAPACITY; 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 __BATTERYVOLTAGE_ISSET_ID = 0; private static final int __BATTERYTEMPERATURE_ISSET_ID = 1; private static final int __BATTERYCAPACITY_ISSET_ID = 2; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.BATTERY_CHARGER,_Fields.BATTERY_HEALTH,_Fields.BATTERY_VOLTAGE,_Fields.BATTERY_TEMPERATURE,_Fields.BATTERY_TECHNOLOGY,_Fields.BATTERY_CAPACITY}; 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.BATTERY_CHARGER, new org.apache.thrift.meta_data.FieldMetaData("batteryCharger", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.BATTERY_HEALTH, new org.apache.thrift.meta_data.FieldMetaData("batteryHealth", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.BATTERY_VOLTAGE, new org.apache.thrift.meta_data.FieldMetaData("batteryVoltage", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); tmpMap.put(_Fields.BATTERY_TEMPERATURE, new org.apache.thrift.meta_data.FieldMetaData("batteryTemperature", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); tmpMap.put(_Fields.BATTERY_TECHNOLOGY, new org.apache.thrift.meta_data.FieldMetaData("batteryTechnology", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.BATTERY_CAPACITY, new org.apache.thrift.meta_data.FieldMetaData("batteryCapacity", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BatteryDetails.class, metaDataMap); } public BatteryDetails() { } /** * Performs a deep copy on <i>other</i>. */ public BatteryDetails(BatteryDetails other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetBatteryCharger()) { this.batteryCharger = other.batteryCharger; } if (other.isSetBatteryHealth()) { this.batteryHealth = other.batteryHealth; } this.batteryVoltage = other.batteryVoltage; this.batteryTemperature = other.batteryTemperature; if (other.isSetBatteryTechnology()) { this.batteryTechnology = other.batteryTechnology; } this.batteryCapacity = other.batteryCapacity; } public BatteryDetails deepCopy() { return new BatteryDetails(this); } @Override public void clear() { this.batteryCharger = null; this.batteryHealth = null; setBatteryVoltageIsSet(false); this.batteryVoltage = 0.0; setBatteryTemperatureIsSet(false); this.batteryTemperature = 0.0; this.batteryTechnology = null; setBatteryCapacityIsSet(false); this.batteryCapacity = 0.0; } public String getBatteryCharger() { return this.batteryCharger; } public BatteryDetails setBatteryCharger(String batteryCharger) { this.batteryCharger = batteryCharger; return this; } public void unsetBatteryCharger() { this.batteryCharger = null; } /** Returns true if field batteryCharger is set (has been assigned a value) and false otherwise */ public boolean isSetBatteryCharger() { return this.batteryCharger != null; } public void setBatteryChargerIsSet(boolean value) { if (!value) { this.batteryCharger = null; } } public String getBatteryHealth() { return this.batteryHealth; } public BatteryDetails setBatteryHealth(String batteryHealth) { this.batteryHealth = batteryHealth; return this; } public void unsetBatteryHealth() { this.batteryHealth = null; } /** Returns true if field batteryHealth is set (has been assigned a value) and false otherwise */ public boolean isSetBatteryHealth() { return this.batteryHealth != null; } public void setBatteryHealthIsSet(boolean value) { if (!value) { this.batteryHealth = null; } } public double getBatteryVoltage() { return this.batteryVoltage; } public BatteryDetails setBatteryVoltage(double batteryVoltage) { this.batteryVoltage = batteryVoltage; setBatteryVoltageIsSet(true); return this; } public void unsetBatteryVoltage() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BATTERYVOLTAGE_ISSET_ID); } /** Returns true if field batteryVoltage is set (has been assigned a value) and false otherwise */ public boolean isSetBatteryVoltage() { return EncodingUtils.testBit(__isset_bitfield, __BATTERYVOLTAGE_ISSET_ID); } public void setBatteryVoltageIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BATTERYVOLTAGE_ISSET_ID, value); } public double getBatteryTemperature() { return this.batteryTemperature; } public BatteryDetails setBatteryTemperature(double batteryTemperature) { this.batteryTemperature = batteryTemperature; setBatteryTemperatureIsSet(true); return this; } public void unsetBatteryTemperature() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BATTERYTEMPERATURE_ISSET_ID); } /** Returns true if field batteryTemperature is set (has been assigned a value) and false otherwise */ public boolean isSetBatteryTemperature() { return EncodingUtils.testBit(__isset_bitfield, __BATTERYTEMPERATURE_ISSET_ID); } public void setBatteryTemperatureIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BATTERYTEMPERATURE_ISSET_ID, value); } public String getBatteryTechnology() { return this.batteryTechnology; } public BatteryDetails setBatteryTechnology(String batteryTechnology) { this.batteryTechnology = batteryTechnology; return this; } public void unsetBatteryTechnology() { this.batteryTechnology = null; } /** Returns true if field batteryTechnology is set (has been assigned a value) and false otherwise */ public boolean isSetBatteryTechnology() { return this.batteryTechnology != null; } public void setBatteryTechnologyIsSet(boolean value) { if (!value) { this.batteryTechnology = null; } } public double getBatteryCapacity() { return this.batteryCapacity; } public BatteryDetails setBatteryCapacity(double batteryCapacity) { this.batteryCapacity = batteryCapacity; setBatteryCapacityIsSet(true); return this; } public void unsetBatteryCapacity() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BATTERYCAPACITY_ISSET_ID); } /** Returns true if field batteryCapacity is set (has been assigned a value) and false otherwise */ public boolean isSetBatteryCapacity() { return EncodingUtils.testBit(__isset_bitfield, __BATTERYCAPACITY_ISSET_ID); } public void setBatteryCapacityIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BATTERYCAPACITY_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { case BATTERY_CHARGER: if (value == null) { unsetBatteryCharger(); } else { setBatteryCharger((String)value); } break; case BATTERY_HEALTH: if (value == null) { unsetBatteryHealth(); } else { setBatteryHealth((String)value); } break; case BATTERY_VOLTAGE: if (value == null) { unsetBatteryVoltage(); } else { setBatteryVoltage((Double)value); } break; case BATTERY_TEMPERATURE: if (value == null) { unsetBatteryTemperature(); } else { setBatteryTemperature((Double)value); } break; case BATTERY_TECHNOLOGY: if (value == null) { unsetBatteryTechnology(); } else { setBatteryTechnology((String)value); } break; case BATTERY_CAPACITY: if (value == null) { unsetBatteryCapacity(); } else { setBatteryCapacity((Double)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case BATTERY_CHARGER: return getBatteryCharger(); case BATTERY_HEALTH: return getBatteryHealth(); case BATTERY_VOLTAGE: return Double.valueOf(getBatteryVoltage()); case BATTERY_TEMPERATURE: return Double.valueOf(getBatteryTemperature()); case BATTERY_TECHNOLOGY: return getBatteryTechnology(); case BATTERY_CAPACITY: return Double.valueOf(getBatteryCapacity()); } 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 BATTERY_CHARGER: return isSetBatteryCharger(); case BATTERY_HEALTH: return isSetBatteryHealth(); case BATTERY_VOLTAGE: return isSetBatteryVoltage(); case BATTERY_TEMPERATURE: return isSetBatteryTemperature(); case BATTERY_TECHNOLOGY: return isSetBatteryTechnology(); case BATTERY_CAPACITY: return isSetBatteryCapacity(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof BatteryDetails) return this.equals((BatteryDetails)that); return false; } public boolean equals(BatteryDetails that) { if (that == null) return false; boolean this_present_batteryCharger = true && this.isSetBatteryCharger(); boolean that_present_batteryCharger = true && that.isSetBatteryCharger(); if (this_present_batteryCharger || that_present_batteryCharger) { if (!(this_present_batteryCharger && that_present_batteryCharger)) return false; if (!this.batteryCharger.equals(that.batteryCharger)) return false; } boolean this_present_batteryHealth = true && this.isSetBatteryHealth(); boolean that_present_batteryHealth = true && that.isSetBatteryHealth(); if (this_present_batteryHealth || that_present_batteryHealth) { if (!(this_present_batteryHealth && that_present_batteryHealth)) return false; if (!this.batteryHealth.equals(that.batteryHealth)) return false; } boolean this_present_batteryVoltage = true && this.isSetBatteryVoltage(); boolean that_present_batteryVoltage = true && that.isSetBatteryVoltage(); if (this_present_batteryVoltage || that_present_batteryVoltage) { if (!(this_present_batteryVoltage && that_present_batteryVoltage)) return false; if (this.batteryVoltage != that.batteryVoltage) return false; } boolean this_present_batteryTemperature = true && this.isSetBatteryTemperature(); boolean that_present_batteryTemperature = true && that.isSetBatteryTemperature(); if (this_present_batteryTemperature || that_present_batteryTemperature) { if (!(this_present_batteryTemperature && that_present_batteryTemperature)) return false; if (this.batteryTemperature != that.batteryTemperature) return false; } boolean this_present_batteryTechnology = true && this.isSetBatteryTechnology(); boolean that_present_batteryTechnology = true && that.isSetBatteryTechnology(); if (this_present_batteryTechnology || that_present_batteryTechnology) { if (!(this_present_batteryTechnology && that_present_batteryTechnology)) return false; if (!this.batteryTechnology.equals(that.batteryTechnology)) return false; } boolean this_present_batteryCapacity = true && this.isSetBatteryCapacity(); boolean that_present_batteryCapacity = true && that.isSetBatteryCapacity(); if (this_present_batteryCapacity || that_present_batteryCapacity) { if (!(this_present_batteryCapacity && that_present_batteryCapacity)) return false; if (this.batteryCapacity != that.batteryCapacity) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_batteryCharger = true && (isSetBatteryCharger()); list.add(present_batteryCharger); if (present_batteryCharger) list.add(batteryCharger); boolean present_batteryHealth = true && (isSetBatteryHealth()); list.add(present_batteryHealth); if (present_batteryHealth) list.add(batteryHealth); boolean present_batteryVoltage = true && (isSetBatteryVoltage()); list.add(present_batteryVoltage); if (present_batteryVoltage) list.add(batteryVoltage); boolean present_batteryTemperature = true && (isSetBatteryTemperature()); list.add(present_batteryTemperature); if (present_batteryTemperature) list.add(batteryTemperature); boolean present_batteryTechnology = true && (isSetBatteryTechnology()); list.add(present_batteryTechnology); if (present_batteryTechnology) list.add(batteryTechnology); boolean present_batteryCapacity = true && (isSetBatteryCapacity()); list.add(present_batteryCapacity); if (present_batteryCapacity) list.add(batteryCapacity); return list.hashCode(); } @Override public int compareTo(BatteryDetails other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetBatteryCharger()).compareTo(other.isSetBatteryCharger()); if (lastComparison != 0) { return lastComparison; } if (isSetBatteryCharger()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batteryCharger, other.batteryCharger); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetBatteryHealth()).compareTo(other.isSetBatteryHealth()); if (lastComparison != 0) { return lastComparison; } if (isSetBatteryHealth()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batteryHealth, other.batteryHealth); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetBatteryVoltage()).compareTo(other.isSetBatteryVoltage()); if (lastComparison != 0) { return lastComparison; } if (isSetBatteryVoltage()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batteryVoltage, other.batteryVoltage); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetBatteryTemperature()).compareTo(other.isSetBatteryTemperature()); if (lastComparison != 0) { return lastComparison; } if (isSetBatteryTemperature()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batteryTemperature, other.batteryTemperature); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetBatteryTechnology()).compareTo(other.isSetBatteryTechnology()); if (lastComparison != 0) { return lastComparison; } if (isSetBatteryTechnology()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batteryTechnology, other.batteryTechnology); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetBatteryCapacity()).compareTo(other.isSetBatteryCapacity()); if (lastComparison != 0) { return lastComparison; } if (isSetBatteryCapacity()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batteryCapacity, other.batteryCapacity); 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("BatteryDetails("); boolean first = true; if (isSetBatteryCharger()) { sb.append("batteryCharger:"); if (this.batteryCharger == null) { sb.append("null"); } else { sb.append(this.batteryCharger); } first = false; } if (isSetBatteryHealth()) { if (!first) sb.append(", "); sb.append("batteryHealth:"); if (this.batteryHealth == null) { sb.append("null"); } else { sb.append(this.batteryHealth); } first = false; } if (isSetBatteryVoltage()) { if (!first) sb.append(", "); sb.append("batteryVoltage:"); sb.append(this.batteryVoltage); first = false; } if (isSetBatteryTemperature()) { if (!first) sb.append(", "); sb.append("batteryTemperature:"); sb.append(this.batteryTemperature); first = false; } if (isSetBatteryTechnology()) { if (!first) sb.append(", "); sb.append("batteryTechnology:"); if (this.batteryTechnology == null) { sb.append("null"); } else { sb.append(this.batteryTechnology); } first = false; } if (isSetBatteryCapacity()) { if (!first) sb.append(", "); sb.append("batteryCapacity:"); sb.append(this.batteryCapacity); 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 BatteryDetailsStandardSchemeFactory implements SchemeFactory { public BatteryDetailsStandardScheme getScheme() { return new BatteryDetailsStandardScheme(); } } private static class BatteryDetailsStandardScheme extends StandardScheme<BatteryDetails> { public void read(org.apache.thrift.protocol.TProtocol iprot, BatteryDetails 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: // BATTERY_CHARGER if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.batteryCharger = iprot.readString(); struct.setBatteryChargerIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // BATTERY_HEALTH if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.batteryHealth = iprot.readString(); struct.setBatteryHealthIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // BATTERY_VOLTAGE if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { struct.batteryVoltage = iprot.readDouble(); struct.setBatteryVoltageIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // BATTERY_TEMPERATURE if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { struct.batteryTemperature = iprot.readDouble(); struct.setBatteryTemperatureIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // BATTERY_TECHNOLOGY if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.batteryTechnology = iprot.readString(); struct.setBatteryTechnologyIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // BATTERY_CAPACITY if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) { struct.batteryCapacity = iprot.readDouble(); struct.setBatteryCapacityIsSet(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, BatteryDetails struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.batteryCharger != null) { if (struct.isSetBatteryCharger()) { oprot.writeFieldBegin(BATTERY_CHARGER_FIELD_DESC); oprot.writeString(struct.batteryCharger); oprot.writeFieldEnd(); } } if (struct.batteryHealth != null) { if (struct.isSetBatteryHealth()) { oprot.writeFieldBegin(BATTERY_HEALTH_FIELD_DESC); oprot.writeString(struct.batteryHealth); oprot.writeFieldEnd(); } } if (struct.isSetBatteryVoltage()) { oprot.writeFieldBegin(BATTERY_VOLTAGE_FIELD_DESC); oprot.writeDouble(struct.batteryVoltage); oprot.writeFieldEnd(); } if (struct.isSetBatteryTemperature()) { oprot.writeFieldBegin(BATTERY_TEMPERATURE_FIELD_DESC); oprot.writeDouble(struct.batteryTemperature); oprot.writeFieldEnd(); } if (struct.batteryTechnology != null) { if (struct.isSetBatteryTechnology()) { oprot.writeFieldBegin(BATTERY_TECHNOLOGY_FIELD_DESC); oprot.writeString(struct.batteryTechnology); oprot.writeFieldEnd(); } } if (struct.isSetBatteryCapacity()) { oprot.writeFieldBegin(BATTERY_CAPACITY_FIELD_DESC); oprot.writeDouble(struct.batteryCapacity); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class BatteryDetailsTupleSchemeFactory implements SchemeFactory { public BatteryDetailsTupleScheme getScheme() { return new BatteryDetailsTupleScheme(); } } private static class BatteryDetailsTupleScheme extends TupleScheme<BatteryDetails> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, BatteryDetails struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetBatteryCharger()) { optionals.set(0); } if (struct.isSetBatteryHealth()) { optionals.set(1); } if (struct.isSetBatteryVoltage()) { optionals.set(2); } if (struct.isSetBatteryTemperature()) { optionals.set(3); } if (struct.isSetBatteryTechnology()) { optionals.set(4); } if (struct.isSetBatteryCapacity()) { optionals.set(5); } oprot.writeBitSet(optionals, 6); if (struct.isSetBatteryCharger()) { oprot.writeString(struct.batteryCharger); } if (struct.isSetBatteryHealth()) { oprot.writeString(struct.batteryHealth); } if (struct.isSetBatteryVoltage()) { oprot.writeDouble(struct.batteryVoltage); } if (struct.isSetBatteryTemperature()) { oprot.writeDouble(struct.batteryTemperature); } if (struct.isSetBatteryTechnology()) { oprot.writeString(struct.batteryTechnology); } if (struct.isSetBatteryCapacity()) { oprot.writeDouble(struct.batteryCapacity); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, BatteryDetails struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { struct.batteryCharger = iprot.readString(); struct.setBatteryChargerIsSet(true); } if (incoming.get(1)) { struct.batteryHealth = iprot.readString(); struct.setBatteryHealthIsSet(true); } if (incoming.get(2)) { struct.batteryVoltage = iprot.readDouble(); struct.setBatteryVoltageIsSet(true); } if (incoming.get(3)) { struct.batteryTemperature = iprot.readDouble(); struct.setBatteryTemperatureIsSet(true); } if (incoming.get(4)) { struct.batteryTechnology = iprot.readString(); struct.setBatteryTechnologyIsSet(true); } if (incoming.get(5)) { struct.batteryCapacity = iprot.readDouble(); struct.setBatteryCapacityIsSet(true); } } } }