/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package cgl.iotcloud.core.api.thrift; 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; @SuppressWarnings("all") public class TSensor implements org.apache.thrift.TBase<TSensor, TSensor._Fields>, java.io.Serializable, Cloneable, Comparable<TSensor> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSensor"); private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField SITE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("siteId", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.I32, (short)3); private static final org.apache.thrift.protocol.TField METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("metadata", org.apache.thrift.protocol.TType.STRING, (short)4); private static final org.apache.thrift.protocol.TField CHANNELS_FIELD_DESC = new org.apache.thrift.protocol.TField("channels", org.apache.thrift.protocol.TType.LIST, (short)5); private static final org.apache.thrift.protocol.TField SENSOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("sensorId", org.apache.thrift.protocol.TType.STRING, (short)6); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new TSensorStandardSchemeFactory()); schemes.put(TupleScheme.class, new TSensorTupleSchemeFactory()); } public String name; // required public String siteId; // required /** * * @see TSensorState */ public TSensorState state; // required public ByteBuffer metadata; // required public List<TChannel> channels; // required public String sensorId; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { NAME((short)1, "name"), SITE_ID((short)2, "siteId"), /** * * @see TSensorState */ STATE((short)3, "state"), METADATA((short)4, "metadata"), CHANNELS((short)5, "channels"), SENSOR_ID((short)6, "sensorId"); 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: // SITE_ID return SITE_ID; case 3: // STATE return STATE; case 4: // METADATA return METADATA; case 5: // CHANNELS return CHANNELS; case 6: // SENSOR_ID return SENSOR_ID; 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 _Fields optionals[] = {_Fields.SENSOR_ID}; 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.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.SITE_ID, new org.apache.thrift.meta_data.FieldMetaData("siteId", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSensorState.class))); tmpMap.put(_Fields.METADATA, new org.apache.thrift.meta_data.FieldMetaData("metadata", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.CHANNELS, new org.apache.thrift.meta_data.FieldMetaData("channels", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TChannel.class)))); tmpMap.put(_Fields.SENSOR_ID, new org.apache.thrift.meta_data.FieldMetaData("sensorId", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSensor.class, metaDataMap); } public TSensor() { } public TSensor( String name, String siteId, TSensorState state, ByteBuffer metadata, List<TChannel> channels) { this(); this.name = name; this.siteId = siteId; this.state = state; this.metadata = metadata; this.channels = channels; } /** * Performs a deep copy on <i>other</i>. */ public TSensor(TSensor other) { if (other.isSetName()) { this.name = other.name; } if (other.isSetSiteId()) { this.siteId = other.siteId; } if (other.isSetState()) { this.state = other.state; } if (other.isSetMetadata()) { this.metadata = org.apache.thrift.TBaseHelper.copyBinary(other.metadata); ; } if (other.isSetChannels()) { List<TChannel> __this__channels = new ArrayList<TChannel>(other.channels.size()); for (TChannel other_element : other.channels) { __this__channels.add(new TChannel(other_element)); } this.channels = __this__channels; } if (other.isSetSensorId()) { this.sensorId = other.sensorId; } } public TSensor deepCopy() { return new TSensor(this); } @Override public void clear() { this.name = null; this.siteId = null; this.state = null; this.metadata = null; this.channels = null; this.sensorId = null; } public String getName() { return this.name; } public TSensor 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 String getSiteId() { return this.siteId; } public TSensor setSiteId(String siteId) { this.siteId = siteId; return this; } public void unsetSiteId() { this.siteId = null; } /** Returns true if field siteId is set (has been assigned a value) and false otherwise */ public boolean isSetSiteId() { return this.siteId != null; } public void setSiteIdIsSet(boolean value) { if (!value) { this.siteId = null; } } /** * * @see TSensorState */ public TSensorState getState() { return this.state; } /** * * @see TSensorState */ public TSensor setState(TSensorState state) { this.state = state; return this; } public void unsetState() { this.state = null; } /** Returns true if field state is set (has been assigned a value) and false otherwise */ public boolean isSetState() { return this.state != null; } public void setStateIsSet(boolean value) { if (!value) { this.state = null; } } public byte[] getMetadata() { setMetadata(org.apache.thrift.TBaseHelper.rightSize(metadata)); return metadata == null ? null : metadata.array(); } public ByteBuffer bufferForMetadata() { return metadata; } public TSensor setMetadata(byte[] metadata) { setMetadata(metadata == null ? (ByteBuffer)null : ByteBuffer.wrap(metadata)); return this; } public TSensor setMetadata(ByteBuffer metadata) { this.metadata = metadata; return this; } public void unsetMetadata() { this.metadata = null; } /** Returns true if field metadata is set (has been assigned a value) and false otherwise */ public boolean isSetMetadata() { return this.metadata != null; } public void setMetadataIsSet(boolean value) { if (!value) { this.metadata = null; } } public int getChannelsSize() { return (this.channels == null) ? 0 : this.channels.size(); } public java.util.Iterator<TChannel> getChannelsIterator() { return (this.channels == null) ? null : this.channels.iterator(); } public void addToChannels(TChannel elem) { if (this.channels == null) { this.channels = new ArrayList<TChannel>(); } this.channels.add(elem); } public List<TChannel> getChannels() { return this.channels; } public TSensor setChannels(List<TChannel> channels) { this.channels = channels; return this; } public void unsetChannels() { this.channels = null; } /** Returns true if field channels is set (has been assigned a value) and false otherwise */ public boolean isSetChannels() { return this.channels != null; } public void setChannelsIsSet(boolean value) { if (!value) { this.channels = null; } } public String getSensorId() { return this.sensorId; } public TSensor setSensorId(String sensorId) { this.sensorId = sensorId; return this; } public void unsetSensorId() { this.sensorId = null; } /** Returns true if field sensorId is set (has been assigned a value) and false otherwise */ public boolean isSetSensorId() { return this.sensorId != null; } public void setSensorIdIsSet(boolean value) { if (!value) { this.sensorId = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case NAME: if (value == null) { unsetName(); } else { setName((String)value); } break; case SITE_ID: if (value == null) { unsetSiteId(); } else { setSiteId((String)value); } break; case STATE: if (value == null) { unsetState(); } else { setState((TSensorState)value); } break; case METADATA: if (value == null) { unsetMetadata(); } else { setMetadata((ByteBuffer)value); } break; case CHANNELS: if (value == null) { unsetChannels(); } else { setChannels((List<TChannel>)value); } break; case SENSOR_ID: if (value == null) { unsetSensorId(); } else { setSensorId((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case NAME: return getName(); case SITE_ID: return getSiteId(); case STATE: return getState(); case METADATA: return getMetadata(); case CHANNELS: return getChannels(); case SENSOR_ID: return getSensorId(); } 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 SITE_ID: return isSetSiteId(); case STATE: return isSetState(); case METADATA: return isSetMetadata(); case CHANNELS: return isSetChannels(); case SENSOR_ID: return isSetSensorId(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TSensor) return this.equals((TSensor)that); return false; } public boolean equals(TSensor 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_siteId = true && this.isSetSiteId(); boolean that_present_siteId = true && that.isSetSiteId(); if (this_present_siteId || that_present_siteId) { if (!(this_present_siteId && that_present_siteId)) return false; if (!this.siteId.equals(that.siteId)) return false; } boolean this_present_state = true && this.isSetState(); boolean that_present_state = true && that.isSetState(); if (this_present_state || that_present_state) { if (!(this_present_state && that_present_state)) return false; if (!this.state.equals(that.state)) return false; } boolean this_present_metadata = true && this.isSetMetadata(); boolean that_present_metadata = true && that.isSetMetadata(); if (this_present_metadata || that_present_metadata) { if (!(this_present_metadata && that_present_metadata)) return false; if (!this.metadata.equals(that.metadata)) return false; } boolean this_present_channels = true && this.isSetChannels(); boolean that_present_channels = true && that.isSetChannels(); if (this_present_channels || that_present_channels) { if (!(this_present_channels && that_present_channels)) return false; if (!this.channels.equals(that.channels)) return false; } boolean this_present_sensorId = true && this.isSetSensorId(); boolean that_present_sensorId = true && that.isSetSensorId(); if (this_present_sensorId || that_present_sensorId) { if (!(this_present_sensorId && that_present_sensorId)) return false; if (!this.sensorId.equals(that.sensorId)) return false; } return true; } @Override public int hashCode() { return 0; } @Override public int compareTo(TSensor 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 = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSiteId()).compareTo(other.isSetSiteId()); if (lastComparison != 0) { return lastComparison; } if (isSetSiteId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.siteId, other.siteId); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetState()).compareTo(other.isSetState()); if (lastComparison != 0) { return lastComparison; } if (isSetState()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetMetadata()).compareTo(other.isSetMetadata()); if (lastComparison != 0) { return lastComparison; } if (isSetMetadata()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metadata, other.metadata); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetChannels()).compareTo(other.isSetChannels()); if (lastComparison != 0) { return lastComparison; } if (isSetChannels()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.channels, other.channels); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetSensorId()).compareTo(other.isSetSensorId()); if (lastComparison != 0) { return lastComparison; } if (isSetSensorId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sensorId, other.sensorId); 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("TSensor("); 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("siteId:"); if (this.siteId == null) { sb.append("null"); } else { sb.append(this.siteId); } first = false; if (!first) sb.append(", "); sb.append("state:"); if (this.state == null) { sb.append("null"); } else { sb.append(this.state); } first = false; if (!first) sb.append(", "); sb.append("metadata:"); if (this.metadata == null) { sb.append("null"); } else { org.apache.thrift.TBaseHelper.toString(this.metadata, sb); } first = false; if (!first) sb.append(", "); sb.append("channels:"); if (this.channels == null) { sb.append("null"); } else { sb.append(this.channels); } first = false; if (isSetSensorId()) { if (!first) sb.append(", "); sb.append("sensorId:"); if (this.sensorId == null) { sb.append("null"); } else { sb.append(this.sensorId); } 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 { 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 TSensorStandardSchemeFactory implements SchemeFactory { public TSensorStandardScheme getScheme() { return new TSensorStandardScheme(); } } private static class TSensorStandardScheme extends StandardScheme<TSensor> { public void read(org.apache.thrift.protocol.TProtocol iprot, TSensor 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: // NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.name = iprot.readString(); struct.setNameIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // SITE_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.siteId = iprot.readString(); struct.setSiteIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // STATE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.state = TSensorState.findByValue(iprot.readI32()); struct.setStateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // METADATA if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.metadata = iprot.readBinary(); struct.setMetadataIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 5: // CHANNELS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list20 = iprot.readListBegin(); struct.channels = new ArrayList<TChannel>(_list20.size); for (int _i21 = 0; _i21 < _list20.size; ++_i21) { TChannel _elem22; _elem22 = new TChannel(); _elem22.read(iprot); struct.channels.add(_elem22); } iprot.readListEnd(); } struct.setChannelsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 6: // SENSOR_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.sensorId = iprot.readString(); struct.setSensorIdIsSet(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, TSensor struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.name != null) { oprot.writeFieldBegin(NAME_FIELD_DESC); oprot.writeString(struct.name); oprot.writeFieldEnd(); } if (struct.siteId != null) { oprot.writeFieldBegin(SITE_ID_FIELD_DESC); oprot.writeString(struct.siteId); oprot.writeFieldEnd(); } if (struct.state != null) { oprot.writeFieldBegin(STATE_FIELD_DESC); oprot.writeI32(struct.state.getValue()); oprot.writeFieldEnd(); } if (struct.metadata != null) { oprot.writeFieldBegin(METADATA_FIELD_DESC); oprot.writeBinary(struct.metadata); oprot.writeFieldEnd(); } if (struct.channels != null) { oprot.writeFieldBegin(CHANNELS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.channels.size())); for (TChannel _iter23 : struct.channels) { _iter23.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.sensorId != null) { if (struct.isSetSensorId()) { oprot.writeFieldBegin(SENSOR_ID_FIELD_DESC); oprot.writeString(struct.sensorId); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class TSensorTupleSchemeFactory implements SchemeFactory { public TSensorTupleScheme getScheme() { return new TSensorTupleScheme(); } } private static class TSensorTupleScheme extends TupleScheme<TSensor> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, TSensor struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetName()) { optionals.set(0); } if (struct.isSetSiteId()) { optionals.set(1); } if (struct.isSetState()) { optionals.set(2); } if (struct.isSetMetadata()) { optionals.set(3); } if (struct.isSetChannels()) { optionals.set(4); } if (struct.isSetSensorId()) { optionals.set(5); } oprot.writeBitSet(optionals, 6); if (struct.isSetName()) { oprot.writeString(struct.name); } if (struct.isSetSiteId()) { oprot.writeString(struct.siteId); } if (struct.isSetState()) { oprot.writeI32(struct.state.getValue()); } if (struct.isSetMetadata()) { oprot.writeBinary(struct.metadata); } if (struct.isSetChannels()) { { oprot.writeI32(struct.channels.size()); for (TChannel _iter24 : struct.channels) { _iter24.write(oprot); } } } if (struct.isSetSensorId()) { oprot.writeString(struct.sensorId); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, TSensor struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { struct.name = iprot.readString(); struct.setNameIsSet(true); } if (incoming.get(1)) { struct.siteId = iprot.readString(); struct.setSiteIdIsSet(true); } if (incoming.get(2)) { struct.state = TSensorState.findByValue(iprot.readI32()); struct.setStateIsSet(true); } if (incoming.get(3)) { struct.metadata = iprot.readBinary(); struct.setMetadataIsSet(true); } if (incoming.get(4)) { { org.apache.thrift.protocol.TList _list25 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.channels = new ArrayList<TChannel>(_list25.size); for (int _i26 = 0; _i26 < _list25.size; ++_i26) { TChannel _elem27; _elem27 = new TChannel(); _elem27.read(iprot); struct.channels.add(_elem27); } } struct.setChannelsIsSet(true); } if (incoming.get(5)) { struct.sensorId = iprot.readString(); struct.setSensorIdIsSet(true); } } } }