All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.btnguyen2k.queueserver.thrift.TQueueMessage Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.github.btnguyen2k.queueserver.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;

public class TQueueMessage implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TQueueMessage");

  private static final org.apache.thrift.protocol.TField QUEUE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("queueId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField MSG_ORG_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("msgOrgTimestamp", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField MSG_TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("msgTimestamp", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField MSG_NUM_REQUEUES_FIELD_DESC = new org.apache.thrift.protocol.TField("msgNumRequeues", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField MSG_CONTENT_FIELD_DESC = new org.apache.thrift.protocol.TField("msgContent", org.apache.thrift.protocol.TType.STRING, (short)5);

  private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new TQueueMessageStandardSchemeFactory());
    schemes.put(TupleScheme.class, new TQueueMessageTupleSchemeFactory());
  }

  public long queueId; // required
  public long msgOrgTimestamp; // required
  public long msgTimestamp; // required
  public int msgNumRequeues; // required
  public ByteBuffer msgContent; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    QUEUE_ID((short)1, "queueId"),
    MSG_ORG_TIMESTAMP((short)2, "msgOrgTimestamp"),
    MSG_TIMESTAMP((short)3, "msgTimestamp"),
    MSG_NUM_REQUEUES((short)4, "msgNumRequeues"),
    MSG_CONTENT((short)5, "msgContent");

    private static final Map byName = new HashMap();

    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: // QUEUE_ID
          return QUEUE_ID;
        case 2: // MSG_ORG_TIMESTAMP
          return MSG_ORG_TIMESTAMP;
        case 3: // MSG_TIMESTAMP
          return MSG_TIMESTAMP;
        case 4: // MSG_NUM_REQUEUES
          return MSG_NUM_REQUEUES;
        case 5: // MSG_CONTENT
          return MSG_CONTENT;
        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 __QUEUEID_ISSET_ID = 0;
  private static final int __MSGORGTIMESTAMP_ISSET_ID = 1;
  private static final int __MSGTIMESTAMP_ISSET_ID = 2;
  private static final int __MSGNUMREQUEUES_ISSET_ID = 3;
  private byte __isset_bitfield = 0;
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.QUEUE_ID, new org.apache.thrift.meta_data.FieldMetaData("queueId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MSG_ORG_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("msgOrgTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MSG_TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("msgTimestamp", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MSG_NUM_REQUEUES, new org.apache.thrift.meta_data.FieldMetaData("msgNumRequeues", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.MSG_CONTENT, new org.apache.thrift.meta_data.FieldMetaData("msgContent", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TQueueMessage.class, metaDataMap);
  }

  public TQueueMessage() {
    this.queueId = 0L;

    this.msgOrgTimestamp = 0L;

    this.msgTimestamp = 0L;

    this.msgNumRequeues = 0;

  }

  public TQueueMessage(
    long queueId,
    long msgOrgTimestamp,
    long msgTimestamp,
    int msgNumRequeues,
    ByteBuffer msgContent)
  {
    this();
    this.queueId = queueId;
    setQueueIdIsSet(true);
    this.msgOrgTimestamp = msgOrgTimestamp;
    setMsgOrgTimestampIsSet(true);
    this.msgTimestamp = msgTimestamp;
    setMsgTimestampIsSet(true);
    this.msgNumRequeues = msgNumRequeues;
    setMsgNumRequeuesIsSet(true);
    this.msgContent = msgContent;
  }

  /**
   * Performs a deep copy on other.
   */
  public TQueueMessage(TQueueMessage other) {
    __isset_bitfield = other.__isset_bitfield;
    this.queueId = other.queueId;
    this.msgOrgTimestamp = other.msgOrgTimestamp;
    this.msgTimestamp = other.msgTimestamp;
    this.msgNumRequeues = other.msgNumRequeues;
    if (other.isSetMsgContent()) {
      this.msgContent = org.apache.thrift.TBaseHelper.copyBinary(other.msgContent);
;
    }
  }

  public TQueueMessage deepCopy() {
    return new TQueueMessage(this);
  }

  @Override
  public void clear() {
    this.queueId = 0L;

    this.msgOrgTimestamp = 0L;

    this.msgTimestamp = 0L;

    this.msgNumRequeues = 0;

    this.msgContent = null;
  }

  public long getQueueId() {
    return this.queueId;
  }

  public TQueueMessage setQueueId(long queueId) {
    this.queueId = queueId;
    setQueueIdIsSet(true);
    return this;
  }

  public void unsetQueueId() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __QUEUEID_ISSET_ID);
  }

  /** Returns true if field queueId is set (has been assigned a value) and false otherwise */
  public boolean isSetQueueId() {
    return EncodingUtils.testBit(__isset_bitfield, __QUEUEID_ISSET_ID);
  }

  public void setQueueIdIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __QUEUEID_ISSET_ID, value);
  }

  public long getMsgOrgTimestamp() {
    return this.msgOrgTimestamp;
  }

  public TQueueMessage setMsgOrgTimestamp(long msgOrgTimestamp) {
    this.msgOrgTimestamp = msgOrgTimestamp;
    setMsgOrgTimestampIsSet(true);
    return this;
  }

  public void unsetMsgOrgTimestamp() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MSGORGTIMESTAMP_ISSET_ID);
  }

  /** Returns true if field msgOrgTimestamp is set (has been assigned a value) and false otherwise */
  public boolean isSetMsgOrgTimestamp() {
    return EncodingUtils.testBit(__isset_bitfield, __MSGORGTIMESTAMP_ISSET_ID);
  }

  public void setMsgOrgTimestampIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MSGORGTIMESTAMP_ISSET_ID, value);
  }

  public long getMsgTimestamp() {
    return this.msgTimestamp;
  }

  public TQueueMessage setMsgTimestamp(long msgTimestamp) {
    this.msgTimestamp = msgTimestamp;
    setMsgTimestampIsSet(true);
    return this;
  }

  public void unsetMsgTimestamp() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MSGTIMESTAMP_ISSET_ID);
  }

  /** Returns true if field msgTimestamp is set (has been assigned a value) and false otherwise */
  public boolean isSetMsgTimestamp() {
    return EncodingUtils.testBit(__isset_bitfield, __MSGTIMESTAMP_ISSET_ID);
  }

  public void setMsgTimestampIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MSGTIMESTAMP_ISSET_ID, value);
  }

  public int getMsgNumRequeues() {
    return this.msgNumRequeues;
  }

  public TQueueMessage setMsgNumRequeues(int msgNumRequeues) {
    this.msgNumRequeues = msgNumRequeues;
    setMsgNumRequeuesIsSet(true);
    return this;
  }

  public void unsetMsgNumRequeues() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MSGNUMREQUEUES_ISSET_ID);
  }

  /** Returns true if field msgNumRequeues is set (has been assigned a value) and false otherwise */
  public boolean isSetMsgNumRequeues() {
    return EncodingUtils.testBit(__isset_bitfield, __MSGNUMREQUEUES_ISSET_ID);
  }

  public void setMsgNumRequeuesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MSGNUMREQUEUES_ISSET_ID, value);
  }

  public byte[] getMsgContent() {
    setMsgContent(org.apache.thrift.TBaseHelper.rightSize(msgContent));
    return msgContent == null ? null : msgContent.array();
  }

  public ByteBuffer bufferForMsgContent() {
    return msgContent;
  }

  public TQueueMessage setMsgContent(byte[] msgContent) {
    setMsgContent(msgContent == null ? (ByteBuffer)null : ByteBuffer.wrap(msgContent));
    return this;
  }

  public TQueueMessage setMsgContent(ByteBuffer msgContent) {
    this.msgContent = msgContent;
    return this;
  }

  public void unsetMsgContent() {
    this.msgContent = null;
  }

  /** Returns true if field msgContent is set (has been assigned a value) and false otherwise */
  public boolean isSetMsgContent() {
    return this.msgContent != null;
  }

  public void setMsgContentIsSet(boolean value) {
    if (!value) {
      this.msgContent = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case QUEUE_ID:
      if (value == null) {
        unsetQueueId();
      } else {
        setQueueId((Long)value);
      }
      break;

    case MSG_ORG_TIMESTAMP:
      if (value == null) {
        unsetMsgOrgTimestamp();
      } else {
        setMsgOrgTimestamp((Long)value);
      }
      break;

    case MSG_TIMESTAMP:
      if (value == null) {
        unsetMsgTimestamp();
      } else {
        setMsgTimestamp((Long)value);
      }
      break;

    case MSG_NUM_REQUEUES:
      if (value == null) {
        unsetMsgNumRequeues();
      } else {
        setMsgNumRequeues((Integer)value);
      }
      break;

    case MSG_CONTENT:
      if (value == null) {
        unsetMsgContent();
      } else {
        setMsgContent((ByteBuffer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case QUEUE_ID:
      return Long.valueOf(getQueueId());

    case MSG_ORG_TIMESTAMP:
      return Long.valueOf(getMsgOrgTimestamp());

    case MSG_TIMESTAMP:
      return Long.valueOf(getMsgTimestamp());

    case MSG_NUM_REQUEUES:
      return Integer.valueOf(getMsgNumRequeues());

    case MSG_CONTENT:
      return getMsgContent();

    }
    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 QUEUE_ID:
      return isSetQueueId();
    case MSG_ORG_TIMESTAMP:
      return isSetMsgOrgTimestamp();
    case MSG_TIMESTAMP:
      return isSetMsgTimestamp();
    case MSG_NUM_REQUEUES:
      return isSetMsgNumRequeues();
    case MSG_CONTENT:
      return isSetMsgContent();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof TQueueMessage)
      return this.equals((TQueueMessage)that);
    return false;
  }

  public boolean equals(TQueueMessage that) {
    if (that == null)
      return false;

    boolean this_present_queueId = true;
    boolean that_present_queueId = true;
    if (this_present_queueId || that_present_queueId) {
      if (!(this_present_queueId && that_present_queueId))
        return false;
      if (this.queueId != that.queueId)
        return false;
    }

    boolean this_present_msgOrgTimestamp = true;
    boolean that_present_msgOrgTimestamp = true;
    if (this_present_msgOrgTimestamp || that_present_msgOrgTimestamp) {
      if (!(this_present_msgOrgTimestamp && that_present_msgOrgTimestamp))
        return false;
      if (this.msgOrgTimestamp != that.msgOrgTimestamp)
        return false;
    }

    boolean this_present_msgTimestamp = true;
    boolean that_present_msgTimestamp = true;
    if (this_present_msgTimestamp || that_present_msgTimestamp) {
      if (!(this_present_msgTimestamp && that_present_msgTimestamp))
        return false;
      if (this.msgTimestamp != that.msgTimestamp)
        return false;
    }

    boolean this_present_msgNumRequeues = true;
    boolean that_present_msgNumRequeues = true;
    if (this_present_msgNumRequeues || that_present_msgNumRequeues) {
      if (!(this_present_msgNumRequeues && that_present_msgNumRequeues))
        return false;
      if (this.msgNumRequeues != that.msgNumRequeues)
        return false;
    }

    boolean this_present_msgContent = true && this.isSetMsgContent();
    boolean that_present_msgContent = true && that.isSetMsgContent();
    if (this_present_msgContent || that_present_msgContent) {
      if (!(this_present_msgContent && that_present_msgContent))
        return false;
      if (!this.msgContent.equals(that.msgContent))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

  @Override
  public int compareTo(TQueueMessage other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetQueueId()).compareTo(other.isSetQueueId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueueId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queueId, other.queueId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMsgOrgTimestamp()).compareTo(other.isSetMsgOrgTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMsgOrgTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgOrgTimestamp, other.msgOrgTimestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMsgTimestamp()).compareTo(other.isSetMsgTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMsgTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgTimestamp, other.msgTimestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMsgNumRequeues()).compareTo(other.isSetMsgNumRequeues());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMsgNumRequeues()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgNumRequeues, other.msgNumRequeues);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMsgContent()).compareTo(other.isSetMsgContent());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMsgContent()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msgContent, other.msgContent);
      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("TQueueMessage(");
    boolean first = true;

    sb.append("queueId:");
    sb.append(this.queueId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("msgOrgTimestamp:");
    sb.append(this.msgOrgTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("msgTimestamp:");
    sb.append(this.msgTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("msgNumRequeues:");
    sb.append(this.msgNumRequeues);
    first = false;
    if (!first) sb.append(", ");
    sb.append("msgContent:");
    if (this.msgContent == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.msgContent, sb);
    }
    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 TQueueMessageStandardSchemeFactory implements SchemeFactory {
    public TQueueMessageStandardScheme getScheme() {
      return new TQueueMessageStandardScheme();
    }
  }

  private static class TQueueMessageStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TQueueMessage 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: // QUEUE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.queueId = iprot.readI64();
              struct.setQueueIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // MSG_ORG_TIMESTAMP
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.msgOrgTimestamp = iprot.readI64();
              struct.setMsgOrgTimestampIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // MSG_TIMESTAMP
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.msgTimestamp = iprot.readI64();
              struct.setMsgTimestampIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // MSG_NUM_REQUEUES
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.msgNumRequeues = iprot.readI32();
              struct.setMsgNumRequeuesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // MSG_CONTENT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.msgContent = iprot.readBinary();
              struct.setMsgContentIsSet(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, TQueueMessage struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(QUEUE_ID_FIELD_DESC);
      oprot.writeI64(struct.queueId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MSG_ORG_TIMESTAMP_FIELD_DESC);
      oprot.writeI64(struct.msgOrgTimestamp);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MSG_TIMESTAMP_FIELD_DESC);
      oprot.writeI64(struct.msgTimestamp);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MSG_NUM_REQUEUES_FIELD_DESC);
      oprot.writeI32(struct.msgNumRequeues);
      oprot.writeFieldEnd();
      if (struct.msgContent != null) {
        oprot.writeFieldBegin(MSG_CONTENT_FIELD_DESC);
        oprot.writeBinary(struct.msgContent);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TQueueMessageTupleSchemeFactory implements SchemeFactory {
    public TQueueMessageTupleScheme getScheme() {
      return new TQueueMessageTupleScheme();
    }
  }

  private static class TQueueMessageTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TQueueMessage struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetQueueId()) {
        optionals.set(0);
      }
      if (struct.isSetMsgOrgTimestamp()) {
        optionals.set(1);
      }
      if (struct.isSetMsgTimestamp()) {
        optionals.set(2);
      }
      if (struct.isSetMsgNumRequeues()) {
        optionals.set(3);
      }
      if (struct.isSetMsgContent()) {
        optionals.set(4);
      }
      oprot.writeBitSet(optionals, 5);
      if (struct.isSetQueueId()) {
        oprot.writeI64(struct.queueId);
      }
      if (struct.isSetMsgOrgTimestamp()) {
        oprot.writeI64(struct.msgOrgTimestamp);
      }
      if (struct.isSetMsgTimestamp()) {
        oprot.writeI64(struct.msgTimestamp);
      }
      if (struct.isSetMsgNumRequeues()) {
        oprot.writeI32(struct.msgNumRequeues);
      }
      if (struct.isSetMsgContent()) {
        oprot.writeBinary(struct.msgContent);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TQueueMessage struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(5);
      if (incoming.get(0)) {
        struct.queueId = iprot.readI64();
        struct.setQueueIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.msgOrgTimestamp = iprot.readI64();
        struct.setMsgOrgTimestampIsSet(true);
      }
      if (incoming.get(2)) {
        struct.msgTimestamp = iprot.readI64();
        struct.setMsgTimestampIsSet(true);
      }
      if (incoming.get(3)) {
        struct.msgNumRequeues = iprot.readI32();
        struct.setMsgNumRequeuesIsSet(true);
      }
      if (incoming.get(4)) {
        struct.msgContent = iprot.readBinary();
        struct.setMsgContentIsSet(true);
      }
    }
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy