/** * Autogenerated by Thrift Compiler (0.9.3) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package com.facebook.buck.artifact_cache.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 javax.annotation.Generated; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-03-12") public class BuckCacheResponse implements org.apache.thrift.TBase<BuckCacheResponse, BuckCacheResponse._Fields>, java.io.Serializable, Cloneable, Comparable<BuckCacheResponse> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BuckCacheResponse"); private static final org.apache.thrift.protocol.TField WAS_SUCCESSFUL_FIELD_DESC = new org.apache.thrift.protocol.TField("wasSuccessful", org.apache.thrift.protocol.TType.BOOL, (short)1); private static final org.apache.thrift.protocol.TField ERROR_MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("errorMessage", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)10); private static final org.apache.thrift.protocol.TField PAYLOADS_FIELD_DESC = new org.apache.thrift.protocol.TField("payloads", org.apache.thrift.protocol.TType.LIST, (short)100); private static final org.apache.thrift.protocol.TField FETCH_RESPONSE_FIELD_DESC = new org.apache.thrift.protocol.TField("fetchResponse", org.apache.thrift.protocol.TType.STRUCT, (short)101); private static final org.apache.thrift.protocol.TField STORE_RESPONSE_FIELD_DESC = new org.apache.thrift.protocol.TField("storeResponse", org.apache.thrift.protocol.TType.STRUCT, (short)102); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new BuckCacheResponseStandardSchemeFactory()); schemes.put(TupleScheme.class, new BuckCacheResponseTupleSchemeFactory()); } public boolean wasSuccessful; // optional public String errorMessage; // optional /** * * @see BuckCacheRequestType */ public BuckCacheRequestType type; // optional public List<PayloadInfo> payloads; // optional public BuckCacheFetchResponse fetchResponse; // optional public BuckCacheStoreResponse storeResponse; // 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 { WAS_SUCCESSFUL((short)1, "wasSuccessful"), ERROR_MESSAGE((short)2, "errorMessage"), /** * * @see BuckCacheRequestType */ TYPE((short)10, "type"), PAYLOADS((short)100, "payloads"), FETCH_RESPONSE((short)101, "fetchResponse"), STORE_RESPONSE((short)102, "storeResponse"); 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: // WAS_SUCCESSFUL return WAS_SUCCESSFUL; case 2: // ERROR_MESSAGE return ERROR_MESSAGE; case 10: // TYPE return TYPE; case 100: // PAYLOADS return PAYLOADS; case 101: // FETCH_RESPONSE return FETCH_RESPONSE; case 102: // STORE_RESPONSE return STORE_RESPONSE; 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 __WASSUCCESSFUL_ISSET_ID = 0; private byte __isset_bitfield = 0; private static final _Fields optionals[] = {_Fields.WAS_SUCCESSFUL,_Fields.ERROR_MESSAGE,_Fields.TYPE,_Fields.PAYLOADS,_Fields.FETCH_RESPONSE,_Fields.STORE_RESPONSE}; 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.WAS_SUCCESSFUL, new org.apache.thrift.meta_data.FieldMetaData("wasSuccessful", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.ERROR_MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("errorMessage", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, BuckCacheRequestType.class))); tmpMap.put(_Fields.PAYLOADS, new org.apache.thrift.meta_data.FieldMetaData("payloads", org.apache.thrift.TFieldRequirementType.OPTIONAL, 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, PayloadInfo.class)))); tmpMap.put(_Fields.FETCH_RESPONSE, new org.apache.thrift.meta_data.FieldMetaData("fetchResponse", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, BuckCacheFetchResponse.class))); tmpMap.put(_Fields.STORE_RESPONSE, new org.apache.thrift.meta_data.FieldMetaData("storeResponse", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, BuckCacheStoreResponse.class))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(BuckCacheResponse.class, metaDataMap); } public BuckCacheResponse() { this.type = com.facebook.buck.artifact_cache.thrift.BuckCacheRequestType.UNKNOWN; } /** * Performs a deep copy on <i>other</i>. */ public BuckCacheResponse(BuckCacheResponse other) { __isset_bitfield = other.__isset_bitfield; this.wasSuccessful = other.wasSuccessful; if (other.isSetErrorMessage()) { this.errorMessage = other.errorMessage; } if (other.isSetType()) { this.type = other.type; } if (other.isSetPayloads()) { List<PayloadInfo> __this__payloads = new ArrayList<PayloadInfo>(other.payloads.size()); for (PayloadInfo other_element : other.payloads) { __this__payloads.add(new PayloadInfo(other_element)); } this.payloads = __this__payloads; } if (other.isSetFetchResponse()) { this.fetchResponse = new BuckCacheFetchResponse(other.fetchResponse); } if (other.isSetStoreResponse()) { this.storeResponse = new BuckCacheStoreResponse(other.storeResponse); } } public BuckCacheResponse deepCopy() { return new BuckCacheResponse(this); } @Override public void clear() { setWasSuccessfulIsSet(false); this.wasSuccessful = false; this.errorMessage = null; this.type = com.facebook.buck.artifact_cache.thrift.BuckCacheRequestType.UNKNOWN; this.payloads = null; this.fetchResponse = null; this.storeResponse = null; } public boolean isWasSuccessful() { return this.wasSuccessful; } public BuckCacheResponse setWasSuccessful(boolean wasSuccessful) { this.wasSuccessful = wasSuccessful; setWasSuccessfulIsSet(true); return this; } public void unsetWasSuccessful() { __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WASSUCCESSFUL_ISSET_ID); } /** Returns true if field wasSuccessful is set (has been assigned a value) and false otherwise */ public boolean isSetWasSuccessful() { return EncodingUtils.testBit(__isset_bitfield, __WASSUCCESSFUL_ISSET_ID); } public void setWasSuccessfulIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WASSUCCESSFUL_ISSET_ID, value); } public String getErrorMessage() { return this.errorMessage; } public BuckCacheResponse setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; return this; } public void unsetErrorMessage() { this.errorMessage = null; } /** Returns true if field errorMessage is set (has been assigned a value) and false otherwise */ public boolean isSetErrorMessage() { return this.errorMessage != null; } public void setErrorMessageIsSet(boolean value) { if (!value) { this.errorMessage = null; } } /** * * @see BuckCacheRequestType */ public BuckCacheRequestType getType() { return this.type; } /** * * @see BuckCacheRequestType */ public BuckCacheResponse setType(BuckCacheRequestType type) { this.type = type; return this; } public void unsetType() { this.type = null; } /** Returns true if field type is set (has been assigned a value) and false otherwise */ public boolean isSetType() { return this.type != null; } public void setTypeIsSet(boolean value) { if (!value) { this.type = null; } } public int getPayloadsSize() { return (this.payloads == null) ? 0 : this.payloads.size(); } public java.util.Iterator<PayloadInfo> getPayloadsIterator() { return (this.payloads == null) ? null : this.payloads.iterator(); } public void addToPayloads(PayloadInfo elem) { if (this.payloads == null) { this.payloads = new ArrayList<PayloadInfo>(); } this.payloads.add(elem); } public List<PayloadInfo> getPayloads() { return this.payloads; } public BuckCacheResponse setPayloads(List<PayloadInfo> payloads) { this.payloads = payloads; return this; } public void unsetPayloads() { this.payloads = null; } /** Returns true if field payloads is set (has been assigned a value) and false otherwise */ public boolean isSetPayloads() { return this.payloads != null; } public void setPayloadsIsSet(boolean value) { if (!value) { this.payloads = null; } } public BuckCacheFetchResponse getFetchResponse() { return this.fetchResponse; } public BuckCacheResponse setFetchResponse(BuckCacheFetchResponse fetchResponse) { this.fetchResponse = fetchResponse; return this; } public void unsetFetchResponse() { this.fetchResponse = null; } /** Returns true if field fetchResponse is set (has been assigned a value) and false otherwise */ public boolean isSetFetchResponse() { return this.fetchResponse != null; } public void setFetchResponseIsSet(boolean value) { if (!value) { this.fetchResponse = null; } } public BuckCacheStoreResponse getStoreResponse() { return this.storeResponse; } public BuckCacheResponse setStoreResponse(BuckCacheStoreResponse storeResponse) { this.storeResponse = storeResponse; return this; } public void unsetStoreResponse() { this.storeResponse = null; } /** Returns true if field storeResponse is set (has been assigned a value) and false otherwise */ public boolean isSetStoreResponse() { return this.storeResponse != null; } public void setStoreResponseIsSet(boolean value) { if (!value) { this.storeResponse = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case WAS_SUCCESSFUL: if (value == null) { unsetWasSuccessful(); } else { setWasSuccessful((Boolean)value); } break; case ERROR_MESSAGE: if (value == null) { unsetErrorMessage(); } else { setErrorMessage((String)value); } break; case TYPE: if (value == null) { unsetType(); } else { setType((BuckCacheRequestType)value); } break; case PAYLOADS: if (value == null) { unsetPayloads(); } else { setPayloads((List<PayloadInfo>)value); } break; case FETCH_RESPONSE: if (value == null) { unsetFetchResponse(); } else { setFetchResponse((BuckCacheFetchResponse)value); } break; case STORE_RESPONSE: if (value == null) { unsetStoreResponse(); } else { setStoreResponse((BuckCacheStoreResponse)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case WAS_SUCCESSFUL: return isWasSuccessful(); case ERROR_MESSAGE: return getErrorMessage(); case TYPE: return getType(); case PAYLOADS: return getPayloads(); case FETCH_RESPONSE: return getFetchResponse(); case STORE_RESPONSE: return getStoreResponse(); } 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 WAS_SUCCESSFUL: return isSetWasSuccessful(); case ERROR_MESSAGE: return isSetErrorMessage(); case TYPE: return isSetType(); case PAYLOADS: return isSetPayloads(); case FETCH_RESPONSE: return isSetFetchResponse(); case STORE_RESPONSE: return isSetStoreResponse(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof BuckCacheResponse) return this.equals((BuckCacheResponse)that); return false; } public boolean equals(BuckCacheResponse that) { if (that == null) return false; boolean this_present_wasSuccessful = true && this.isSetWasSuccessful(); boolean that_present_wasSuccessful = true && that.isSetWasSuccessful(); if (this_present_wasSuccessful || that_present_wasSuccessful) { if (!(this_present_wasSuccessful && that_present_wasSuccessful)) return false; if (this.wasSuccessful != that.wasSuccessful) return false; } boolean this_present_errorMessage = true && this.isSetErrorMessage(); boolean that_present_errorMessage = true && that.isSetErrorMessage(); if (this_present_errorMessage || that_present_errorMessage) { if (!(this_present_errorMessage && that_present_errorMessage)) return false; if (!this.errorMessage.equals(that.errorMessage)) return false; } boolean this_present_type = true && this.isSetType(); boolean that_present_type = true && that.isSetType(); if (this_present_type || that_present_type) { if (!(this_present_type && that_present_type)) return false; if (!this.type.equals(that.type)) return false; } boolean this_present_payloads = true && this.isSetPayloads(); boolean that_present_payloads = true && that.isSetPayloads(); if (this_present_payloads || that_present_payloads) { if (!(this_present_payloads && that_present_payloads)) return false; if (!this.payloads.equals(that.payloads)) return false; } boolean this_present_fetchResponse = true && this.isSetFetchResponse(); boolean that_present_fetchResponse = true && that.isSetFetchResponse(); if (this_present_fetchResponse || that_present_fetchResponse) { if (!(this_present_fetchResponse && that_present_fetchResponse)) return false; if (!this.fetchResponse.equals(that.fetchResponse)) return false; } boolean this_present_storeResponse = true && this.isSetStoreResponse(); boolean that_present_storeResponse = true && that.isSetStoreResponse(); if (this_present_storeResponse || that_present_storeResponse) { if (!(this_present_storeResponse && that_present_storeResponse)) return false; if (!this.storeResponse.equals(that.storeResponse)) return false; } return true; } @Override public int hashCode() { List<Object> list = new ArrayList<Object>(); boolean present_wasSuccessful = true && (isSetWasSuccessful()); list.add(present_wasSuccessful); if (present_wasSuccessful) list.add(wasSuccessful); boolean present_errorMessage = true && (isSetErrorMessage()); list.add(present_errorMessage); if (present_errorMessage) list.add(errorMessage); boolean present_type = true && (isSetType()); list.add(present_type); if (present_type) list.add(type.getValue()); boolean present_payloads = true && (isSetPayloads()); list.add(present_payloads); if (present_payloads) list.add(payloads); boolean present_fetchResponse = true && (isSetFetchResponse()); list.add(present_fetchResponse); if (present_fetchResponse) list.add(fetchResponse); boolean present_storeResponse = true && (isSetStoreResponse()); list.add(present_storeResponse); if (present_storeResponse) list.add(storeResponse); return list.hashCode(); } @Override public int compareTo(BuckCacheResponse other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetWasSuccessful()).compareTo(other.isSetWasSuccessful()); if (lastComparison != 0) { return lastComparison; } if (isSetWasSuccessful()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.wasSuccessful, other.wasSuccessful); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetErrorMessage()).compareTo(other.isSetErrorMessage()); if (lastComparison != 0) { return lastComparison; } if (isSetErrorMessage()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errorMessage, other.errorMessage); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType()); if (lastComparison != 0) { return lastComparison; } if (isSetType()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetPayloads()).compareTo(other.isSetPayloads()); if (lastComparison != 0) { return lastComparison; } if (isSetPayloads()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payloads, other.payloads); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetFetchResponse()).compareTo(other.isSetFetchResponse()); if (lastComparison != 0) { return lastComparison; } if (isSetFetchResponse()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fetchResponse, other.fetchResponse); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetStoreResponse()).compareTo(other.isSetStoreResponse()); if (lastComparison != 0) { return lastComparison; } if (isSetStoreResponse()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.storeResponse, other.storeResponse); 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("BuckCacheResponse("); boolean first = true; if (isSetWasSuccessful()) { sb.append("wasSuccessful:"); sb.append(this.wasSuccessful); first = false; } if (isSetErrorMessage()) { if (!first) sb.append(", "); sb.append("errorMessage:"); if (this.errorMessage == null) { sb.append("null"); } else { sb.append(this.errorMessage); } first = false; } if (isSetType()) { if (!first) sb.append(", "); sb.append("type:"); if (this.type == null) { sb.append("null"); } else { sb.append(this.type); } first = false; } if (isSetPayloads()) { if (!first) sb.append(", "); sb.append("payloads:"); if (this.payloads == null) { sb.append("null"); } else { sb.append(this.payloads); } first = false; } if (isSetFetchResponse()) { if (!first) sb.append(", "); sb.append("fetchResponse:"); if (this.fetchResponse == null) { sb.append("null"); } else { sb.append(this.fetchResponse); } first = false; } if (isSetStoreResponse()) { if (!first) sb.append(", "); sb.append("storeResponse:"); if (this.storeResponse == null) { sb.append("null"); } else { sb.append(this.storeResponse); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields // check for sub-struct validity if (fetchResponse != null) { fetchResponse.validate(); } if (storeResponse != null) { storeResponse.validate(); } } 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 BuckCacheResponseStandardSchemeFactory implements SchemeFactory { public BuckCacheResponseStandardScheme getScheme() { return new BuckCacheResponseStandardScheme(); } } private static class BuckCacheResponseStandardScheme extends StandardScheme<BuckCacheResponse> { public void read(org.apache.thrift.protocol.TProtocol iprot, BuckCacheResponse 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: // WAS_SUCCESSFUL if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.wasSuccessful = iprot.readBool(); struct.setWasSuccessfulIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // ERROR_MESSAGE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.errorMessage = iprot.readString(); struct.setErrorMessageIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 10: // TYPE if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.type = com.facebook.buck.artifact_cache.thrift.BuckCacheRequestType.findByValue(iprot.readI32()); struct.setTypeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 100: // PAYLOADS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list42 = iprot.readListBegin(); struct.payloads = new ArrayList<PayloadInfo>(_list42.size); PayloadInfo _elem43; for (int _i44 = 0; _i44 < _list42.size; ++_i44) { _elem43 = new PayloadInfo(); _elem43.read(iprot); struct.payloads.add(_elem43); } iprot.readListEnd(); } struct.setPayloadsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 101: // FETCH_RESPONSE if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.fetchResponse = new BuckCacheFetchResponse(); struct.fetchResponse.read(iprot); struct.setFetchResponseIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 102: // STORE_RESPONSE if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.storeResponse = new BuckCacheStoreResponse(); struct.storeResponse.read(iprot); struct.setStoreResponseIsSet(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, BuckCacheResponse struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.isSetWasSuccessful()) { oprot.writeFieldBegin(WAS_SUCCESSFUL_FIELD_DESC); oprot.writeBool(struct.wasSuccessful); oprot.writeFieldEnd(); } if (struct.errorMessage != null) { if (struct.isSetErrorMessage()) { oprot.writeFieldBegin(ERROR_MESSAGE_FIELD_DESC); oprot.writeString(struct.errorMessage); oprot.writeFieldEnd(); } } if (struct.type != null) { if (struct.isSetType()) { oprot.writeFieldBegin(TYPE_FIELD_DESC); oprot.writeI32(struct.type.getValue()); oprot.writeFieldEnd(); } } if (struct.payloads != null) { if (struct.isSetPayloads()) { oprot.writeFieldBegin(PAYLOADS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.payloads.size())); for (PayloadInfo _iter45 : struct.payloads) { _iter45.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } } if (struct.fetchResponse != null) { if (struct.isSetFetchResponse()) { oprot.writeFieldBegin(FETCH_RESPONSE_FIELD_DESC); struct.fetchResponse.write(oprot); oprot.writeFieldEnd(); } } if (struct.storeResponse != null) { if (struct.isSetStoreResponse()) { oprot.writeFieldBegin(STORE_RESPONSE_FIELD_DESC); struct.storeResponse.write(oprot); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class BuckCacheResponseTupleSchemeFactory implements SchemeFactory { public BuckCacheResponseTupleScheme getScheme() { return new BuckCacheResponseTupleScheme(); } } private static class BuckCacheResponseTupleScheme extends TupleScheme<BuckCacheResponse> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, BuckCacheResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetWasSuccessful()) { optionals.set(0); } if (struct.isSetErrorMessage()) { optionals.set(1); } if (struct.isSetType()) { optionals.set(2); } if (struct.isSetPayloads()) { optionals.set(3); } if (struct.isSetFetchResponse()) { optionals.set(4); } if (struct.isSetStoreResponse()) { optionals.set(5); } oprot.writeBitSet(optionals, 6); if (struct.isSetWasSuccessful()) { oprot.writeBool(struct.wasSuccessful); } if (struct.isSetErrorMessage()) { oprot.writeString(struct.errorMessage); } if (struct.isSetType()) { oprot.writeI32(struct.type.getValue()); } if (struct.isSetPayloads()) { { oprot.writeI32(struct.payloads.size()); for (PayloadInfo _iter46 : struct.payloads) { _iter46.write(oprot); } } } if (struct.isSetFetchResponse()) { struct.fetchResponse.write(oprot); } if (struct.isSetStoreResponse()) { struct.storeResponse.write(oprot); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, BuckCacheResponse struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { struct.wasSuccessful = iprot.readBool(); struct.setWasSuccessfulIsSet(true); } if (incoming.get(1)) { struct.errorMessage = iprot.readString(); struct.setErrorMessageIsSet(true); } if (incoming.get(2)) { struct.type = com.facebook.buck.artifact_cache.thrift.BuckCacheRequestType.findByValue(iprot.readI32()); struct.setTypeIsSet(true); } if (incoming.get(3)) { { org.apache.thrift.protocol.TList _list47 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.payloads = new ArrayList<PayloadInfo>(_list47.size); PayloadInfo _elem48; for (int _i49 = 0; _i49 < _list47.size; ++_i49) { _elem48 = new PayloadInfo(); _elem48.read(iprot); struct.payloads.add(_elem48); } } struct.setPayloadsIsSet(true); } if (incoming.get(4)) { struct.fetchResponse = new BuckCacheFetchResponse(); struct.fetchResponse.read(iprot); struct.setFetchResponseIsSet(true); } if (incoming.get(5)) { struct.storeResponse = new BuckCacheStoreResponse(); struct.storeResponse.read(iprot); struct.setStoreResponseIsSet(true); } } } }