/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.xiaojukeji.carrera.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.2)", date = "2018-2-23")
public class DelayMessage implements org.apache.thrift.TBase<DelayMessage, DelayMessage._Fields>, java.io.Serializable, Cloneable, Comparable<DelayMessage> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DelayMessage");

  private static final org.apache.thrift.protocol.TField TOPIC_FIELD_DESC = new org.apache.thrift.protocol.TField("topic", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField UNIQ_DELAY_MSG_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("uniqDelayMsgId", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField BODY_FIELD_DESC = new org.apache.thrift.protocol.TField("body", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField TAGS_FIELD_DESC = new org.apache.thrift.protocol.TField("tags", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.I32, (short)5);
  private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)6);
  private static final org.apache.thrift.protocol.TField DMSGTYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("dmsgtype", org.apache.thrift.protocol.TType.I32, (short)7);
  private static final org.apache.thrift.protocol.TField INTERVAL_FIELD_DESC = new org.apache.thrift.protocol.TField("interval", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField EXPIRE_FIELD_DESC = new org.apache.thrift.protocol.TField("expire", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField TIMES_FIELD_DESC = new org.apache.thrift.protocol.TField("times", org.apache.thrift.protocol.TType.I64, (short)10);
  private static final org.apache.thrift.protocol.TField UUID_FIELD_DESC = new org.apache.thrift.protocol.TField("uuid", org.apache.thrift.protocol.TType.STRING, (short)11);
  private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.STRING, (short)13);
  private static final org.apache.thrift.protocol.TField PROPERTIES_FIELD_DESC = new org.apache.thrift.protocol.TField("properties", org.apache.thrift.protocol.TType.MAP, (short)14);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new DelayMessageStandardSchemeFactory());
    schemes.put(TupleScheme.class, new DelayMessageTupleSchemeFactory());
  }

  public String topic; // required
  public String uniqDelayMsgId; // optional
  public ByteBuffer body; // optional
  public String tags; // required
  public int action; // required
  public long timestamp; // optional
  public int dmsgtype; // optional
  public long interval; // optional
  public long expire; // optional
  public long times; // optional
  public String uuid; // optional
  public String version; // optional
  public Map<String,String> properties; // 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 {
    TOPIC((short)1, "topic"),
    UNIQ_DELAY_MSG_ID((short)2, "uniqDelayMsgId"),
    BODY((short)3, "body"),
    TAGS((short)4, "tags"),
    ACTION((short)5, "action"),
    TIMESTAMP((short)6, "timestamp"),
    DMSGTYPE((short)7, "dmsgtype"),
    INTERVAL((short)8, "interval"),
    EXPIRE((short)9, "expire"),
    TIMES((short)10, "times"),
    UUID((short)11, "uuid"),
    VERSION((short)13, "version"),
    PROPERTIES((short)14, "properties");

    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: // TOPIC
          return TOPIC;
        case 2: // UNIQ_DELAY_MSG_ID
          return UNIQ_DELAY_MSG_ID;
        case 3: // BODY
          return BODY;
        case 4: // TAGS
          return TAGS;
        case 5: // ACTION
          return ACTION;
        case 6: // TIMESTAMP
          return TIMESTAMP;
        case 7: // DMSGTYPE
          return DMSGTYPE;
        case 8: // INTERVAL
          return INTERVAL;
        case 9: // EXPIRE
          return EXPIRE;
        case 10: // TIMES
          return TIMES;
        case 11: // UUID
          return UUID;
        case 13: // VERSION
          return VERSION;
        case 14: // PROPERTIES
          return PROPERTIES;
        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 __ACTION_ISSET_ID = 0;
  private static final int __TIMESTAMP_ISSET_ID = 1;
  private static final int __DMSGTYPE_ISSET_ID = 2;
  private static final int __INTERVAL_ISSET_ID = 3;
  private static final int __EXPIRE_ISSET_ID = 4;
  private static final int __TIMES_ISSET_ID = 5;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.UNIQ_DELAY_MSG_ID,_Fields.BODY,_Fields.TIMESTAMP,_Fields.DMSGTYPE,_Fields.INTERVAL,_Fields.EXPIRE,_Fields.TIMES,_Fields.UUID,_Fields.VERSION,_Fields.PROPERTIES};
  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.TOPIC, new org.apache.thrift.meta_data.FieldMetaData("topic", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.UNIQ_DELAY_MSG_ID, new org.apache.thrift.meta_data.FieldMetaData("uniqDelayMsgId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BODY, new org.apache.thrift.meta_data.FieldMetaData("body", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.TAGS, new org.apache.thrift.meta_data.FieldMetaData("tags", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DMSGTYPE, new org.apache.thrift.meta_data.FieldMetaData("dmsgtype", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.INTERVAL, new org.apache.thrift.meta_data.FieldMetaData("interval", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.EXPIRE, new org.apache.thrift.meta_data.FieldMetaData("expire", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TIMES, new org.apache.thrift.meta_data.FieldMetaData("times", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.UUID, new org.apache.thrift.meta_data.FieldMetaData("uuid", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PROPERTIES, new org.apache.thrift.meta_data.FieldMetaData("properties", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DelayMessage.class, metaDataMap);
  }

  public DelayMessage() {
  }

  public DelayMessage(
    String topic,
    String tags,
    int action)
  {
    this();
    this.topic = topic;
    this.tags = tags;
    this.action = action;
    setActionIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public DelayMessage(DelayMessage other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetTopic()) {
      this.topic = other.topic;
    }
    if (other.isSetUniqDelayMsgId()) {
      this.uniqDelayMsgId = other.uniqDelayMsgId;
    }
    if (other.isSetBody()) {
      this.body = org.apache.thrift.TBaseHelper.copyBinary(other.body);
    }
    if (other.isSetTags()) {
      this.tags = other.tags;
    }
    this.action = other.action;
    this.timestamp = other.timestamp;
    this.dmsgtype = other.dmsgtype;
    this.interval = other.interval;
    this.expire = other.expire;
    this.times = other.times;
    if (other.isSetUuid()) {
      this.uuid = other.uuid;
    }
    if (other.isSetVersion()) {
      this.version = other.version;
    }
    if (other.isSetProperties()) {
      Map<String,String> __this__properties = new HashMap<String,String>(other.properties);
      this.properties = __this__properties;
    }
  }

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

  @Override
  public void clear() {
    this.topic = null;
    this.uniqDelayMsgId = null;
    this.body = null;
    this.tags = null;
    setActionIsSet(false);
    this.action = 0;
    setTimestampIsSet(false);
    this.timestamp = 0;
    setDmsgtypeIsSet(false);
    this.dmsgtype = 0;
    setIntervalIsSet(false);
    this.interval = 0;
    setExpireIsSet(false);
    this.expire = 0;
    setTimesIsSet(false);
    this.times = 0;
    this.uuid = null;
    this.version = null;
    this.properties = null;
  }

  public String getTopic() {
    return this.topic;
  }

  public DelayMessage setTopic(String topic) {
    this.topic = topic;
    return this;
  }

  public void unsetTopic() {
    this.topic = null;
  }

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

  public void setTopicIsSet(boolean value) {
    if (!value) {
      this.topic = null;
    }
  }

  public String getUniqDelayMsgId() {
    return this.uniqDelayMsgId;
  }

  public DelayMessage setUniqDelayMsgId(String uniqDelayMsgId) {
    this.uniqDelayMsgId = uniqDelayMsgId;
    return this;
  }

  public void unsetUniqDelayMsgId() {
    this.uniqDelayMsgId = null;
  }

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

  public void setUniqDelayMsgIdIsSet(boolean value) {
    if (!value) {
      this.uniqDelayMsgId = null;
    }
  }

  public byte[] getBody() {
    setBody(org.apache.thrift.TBaseHelper.rightSize(body));
    return body == null ? null : body.array();
  }

  public ByteBuffer bufferForBody() {
    return org.apache.thrift.TBaseHelper.copyBinary(body);
  }

  public DelayMessage setBody(byte[] body) {
    this.body = body == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(body, body.length));
    return this;
  }

  public DelayMessage setBody(ByteBuffer body) {
    this.body = org.apache.thrift.TBaseHelper.copyBinary(body);
    return this;
  }

  public void unsetBody() {
    this.body = null;
  }

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

  public void setBodyIsSet(boolean value) {
    if (!value) {
      this.body = null;
    }
  }

  public String getTags() {
    return this.tags;
  }

  public DelayMessage setTags(String tags) {
    this.tags = tags;
    return this;
  }

  public void unsetTags() {
    this.tags = null;
  }

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

  public void setTagsIsSet(boolean value) {
    if (!value) {
      this.tags = null;
    }
  }

  public int getAction() {
    return this.action;
  }

  public DelayMessage setAction(int action) {
    this.action = action;
    setActionIsSet(true);
    return this;
  }

  public void unsetAction() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACTION_ISSET_ID);
  }

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

  public void setActionIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACTION_ISSET_ID, value);
  }

  public long getTimestamp() {
    return this.timestamp;
  }

  public DelayMessage setTimestamp(long timestamp) {
    this.timestamp = timestamp;
    setTimestampIsSet(true);
    return this;
  }

  public void unsetTimestamp() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
  }

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

  public void setTimestampIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
  }

  public int getDmsgtype() {
    return this.dmsgtype;
  }

  public DelayMessage setDmsgtype(int dmsgtype) {
    this.dmsgtype = dmsgtype;
    setDmsgtypeIsSet(true);
    return this;
  }

  public void unsetDmsgtype() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DMSGTYPE_ISSET_ID);
  }

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

  public void setDmsgtypeIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DMSGTYPE_ISSET_ID, value);
  }

  public long getInterval() {
    return this.interval;
  }

  public DelayMessage setInterval(long interval) {
    this.interval = interval;
    setIntervalIsSet(true);
    return this;
  }

  public void unsetInterval() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INTERVAL_ISSET_ID);
  }

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

  public void setIntervalIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INTERVAL_ISSET_ID, value);
  }

  public long getExpire() {
    return this.expire;
  }

  public DelayMessage setExpire(long expire) {
    this.expire = expire;
    setExpireIsSet(true);
    return this;
  }

  public void unsetExpire() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EXPIRE_ISSET_ID);
  }

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

  public void setExpireIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EXPIRE_ISSET_ID, value);
  }

  public long getTimes() {
    return this.times;
  }

  public DelayMessage setTimes(long times) {
    this.times = times;
    setTimesIsSet(true);
    return this;
  }

  public void unsetTimes() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMES_ISSET_ID);
  }

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

  public void setTimesIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMES_ISSET_ID, value);
  }

  public String getUuid() {
    return this.uuid;
  }

  public DelayMessage setUuid(String uuid) {
    this.uuid = uuid;
    return this;
  }

  public void unsetUuid() {
    this.uuid = null;
  }

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

  public void setUuidIsSet(boolean value) {
    if (!value) {
      this.uuid = null;
    }
  }

  public String getVersion() {
    return this.version;
  }

  public DelayMessage setVersion(String version) {
    this.version = version;
    return this;
  }

  public void unsetVersion() {
    this.version = null;
  }

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

  public void setVersionIsSet(boolean value) {
    if (!value) {
      this.version = null;
    }
  }

  public int getPropertiesSize() {
    return (this.properties == null) ? 0 : this.properties.size();
  }

  public void putToProperties(String key, String val) {
    if (this.properties == null) {
      this.properties = new HashMap<String,String>();
    }
    this.properties.put(key, val);
  }

  public Map<String,String> getProperties() {
    return this.properties;
  }

  public DelayMessage setProperties(Map<String,String> properties) {
    this.properties = properties;
    return this;
  }

  public void unsetProperties() {
    this.properties = null;
  }

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

  public void setPropertiesIsSet(boolean value) {
    if (!value) {
      this.properties = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case TOPIC:
      if (value == null) {
        unsetTopic();
      } else {
        setTopic((String)value);
      }
      break;

    case UNIQ_DELAY_MSG_ID:
      if (value == null) {
        unsetUniqDelayMsgId();
      } else {
        setUniqDelayMsgId((String)value);
      }
      break;

    case BODY:
      if (value == null) {
        unsetBody();
      } else {
        setBody((ByteBuffer)value);
      }
      break;

    case TAGS:
      if (value == null) {
        unsetTags();
      } else {
        setTags((String)value);
      }
      break;

    case ACTION:
      if (value == null) {
        unsetAction();
      } else {
        setAction((Integer)value);
      }
      break;

    case TIMESTAMP:
      if (value == null) {
        unsetTimestamp();
      } else {
        setTimestamp((Long)value);
      }
      break;

    case DMSGTYPE:
      if (value == null) {
        unsetDmsgtype();
      } else {
        setDmsgtype((Integer)value);
      }
      break;

    case INTERVAL:
      if (value == null) {
        unsetInterval();
      } else {
        setInterval((Long)value);
      }
      break;

    case EXPIRE:
      if (value == null) {
        unsetExpire();
      } else {
        setExpire((Long)value);
      }
      break;

    case TIMES:
      if (value == null) {
        unsetTimes();
      } else {
        setTimes((Long)value);
      }
      break;

    case UUID:
      if (value == null) {
        unsetUuid();
      } else {
        setUuid((String)value);
      }
      break;

    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((String)value);
      }
      break;

    case PROPERTIES:
      if (value == null) {
        unsetProperties();
      } else {
        setProperties((Map<String,String>)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case TOPIC:
      return getTopic();

    case UNIQ_DELAY_MSG_ID:
      return getUniqDelayMsgId();

    case BODY:
      return getBody();

    case TAGS:
      return getTags();

    case ACTION:
      return Integer.valueOf(getAction());

    case TIMESTAMP:
      return Long.valueOf(getTimestamp());

    case DMSGTYPE:
      return Integer.valueOf(getDmsgtype());

    case INTERVAL:
      return Long.valueOf(getInterval());

    case EXPIRE:
      return Long.valueOf(getExpire());

    case TIMES:
      return Long.valueOf(getTimes());

    case UUID:
      return getUuid();

    case VERSION:
      return getVersion();

    case PROPERTIES:
      return getProperties();

    }
    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 TOPIC:
      return isSetTopic();
    case UNIQ_DELAY_MSG_ID:
      return isSetUniqDelayMsgId();
    case BODY:
      return isSetBody();
    case TAGS:
      return isSetTags();
    case ACTION:
      return isSetAction();
    case TIMESTAMP:
      return isSetTimestamp();
    case DMSGTYPE:
      return isSetDmsgtype();
    case INTERVAL:
      return isSetInterval();
    case EXPIRE:
      return isSetExpire();
    case TIMES:
      return isSetTimes();
    case UUID:
      return isSetUuid();
    case VERSION:
      return isSetVersion();
    case PROPERTIES:
      return isSetProperties();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_topic = true && this.isSetTopic();
    boolean that_present_topic = true && that.isSetTopic();
    if (this_present_topic || that_present_topic) {
      if (!(this_present_topic && that_present_topic))
        return false;
      if (!this.topic.equals(that.topic))
        return false;
    }

    boolean this_present_uniqDelayMsgId = true && this.isSetUniqDelayMsgId();
    boolean that_present_uniqDelayMsgId = true && that.isSetUniqDelayMsgId();
    if (this_present_uniqDelayMsgId || that_present_uniqDelayMsgId) {
      if (!(this_present_uniqDelayMsgId && that_present_uniqDelayMsgId))
        return false;
      if (!this.uniqDelayMsgId.equals(that.uniqDelayMsgId))
        return false;
    }

    boolean this_present_body = true && this.isSetBody();
    boolean that_present_body = true && that.isSetBody();
    if (this_present_body || that_present_body) {
      if (!(this_present_body && that_present_body))
        return false;
      if (!this.body.equals(that.body))
        return false;
    }

    boolean this_present_tags = true && this.isSetTags();
    boolean that_present_tags = true && that.isSetTags();
    if (this_present_tags || that_present_tags) {
      if (!(this_present_tags && that_present_tags))
        return false;
      if (!this.tags.equals(that.tags))
        return false;
    }

    boolean this_present_action = true;
    boolean that_present_action = true;
    if (this_present_action || that_present_action) {
      if (!(this_present_action && that_present_action))
        return false;
      if (this.action != that.action)
        return false;
    }

    boolean this_present_timestamp = true && this.isSetTimestamp();
    boolean that_present_timestamp = true && that.isSetTimestamp();
    if (this_present_timestamp || that_present_timestamp) {
      if (!(this_present_timestamp && that_present_timestamp))
        return false;
      if (this.timestamp != that.timestamp)
        return false;
    }

    boolean this_present_dmsgtype = true && this.isSetDmsgtype();
    boolean that_present_dmsgtype = true && that.isSetDmsgtype();
    if (this_present_dmsgtype || that_present_dmsgtype) {
      if (!(this_present_dmsgtype && that_present_dmsgtype))
        return false;
      if (this.dmsgtype != that.dmsgtype)
        return false;
    }

    boolean this_present_interval = true && this.isSetInterval();
    boolean that_present_interval = true && that.isSetInterval();
    if (this_present_interval || that_present_interval) {
      if (!(this_present_interval && that_present_interval))
        return false;
      if (this.interval != that.interval)
        return false;
    }

    boolean this_present_expire = true && this.isSetExpire();
    boolean that_present_expire = true && that.isSetExpire();
    if (this_present_expire || that_present_expire) {
      if (!(this_present_expire && that_present_expire))
        return false;
      if (this.expire != that.expire)
        return false;
    }

    boolean this_present_times = true && this.isSetTimes();
    boolean that_present_times = true && that.isSetTimes();
    if (this_present_times || that_present_times) {
      if (!(this_present_times && that_present_times))
        return false;
      if (this.times != that.times)
        return false;
    }

    boolean this_present_uuid = true && this.isSetUuid();
    boolean that_present_uuid = true && that.isSetUuid();
    if (this_present_uuid || that_present_uuid) {
      if (!(this_present_uuid && that_present_uuid))
        return false;
      if (!this.uuid.equals(that.uuid))
        return false;
    }

    boolean this_present_version = true && this.isSetVersion();
    boolean that_present_version = true && that.isSetVersion();
    if (this_present_version || that_present_version) {
      if (!(this_present_version && that_present_version))
        return false;
      if (!this.version.equals(that.version))
        return false;
    }

    boolean this_present_properties = true && this.isSetProperties();
    boolean that_present_properties = true && that.isSetProperties();
    if (this_present_properties || that_present_properties) {
      if (!(this_present_properties && that_present_properties))
        return false;
      if (!this.properties.equals(that.properties))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List<Object> list = new ArrayList<Object>();

    boolean present_topic = true && (isSetTopic());
    list.add(present_topic);
    if (present_topic)
      list.add(topic);

    boolean present_uniqDelayMsgId = true && (isSetUniqDelayMsgId());
    list.add(present_uniqDelayMsgId);
    if (present_uniqDelayMsgId)
      list.add(uniqDelayMsgId);

    boolean present_body = true && (isSetBody());
    list.add(present_body);
    if (present_body)
      list.add(body);

    boolean present_tags = true && (isSetTags());
    list.add(present_tags);
    if (present_tags)
      list.add(tags);

    boolean present_action = true;
    list.add(present_action);
    if (present_action)
      list.add(action);

    boolean present_timestamp = true && (isSetTimestamp());
    list.add(present_timestamp);
    if (present_timestamp)
      list.add(timestamp);

    boolean present_dmsgtype = true && (isSetDmsgtype());
    list.add(present_dmsgtype);
    if (present_dmsgtype)
      list.add(dmsgtype);

    boolean present_interval = true && (isSetInterval());
    list.add(present_interval);
    if (present_interval)
      list.add(interval);

    boolean present_expire = true && (isSetExpire());
    list.add(present_expire);
    if (present_expire)
      list.add(expire);

    boolean present_times = true && (isSetTimes());
    list.add(present_times);
    if (present_times)
      list.add(times);

    boolean present_uuid = true && (isSetUuid());
    list.add(present_uuid);
    if (present_uuid)
      list.add(uuid);

    boolean present_version = true && (isSetVersion());
    list.add(present_version);
    if (present_version)
      list.add(version);

    boolean present_properties = true && (isSetProperties());
    list.add(present_properties);
    if (present_properties)
      list.add(properties);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetTopic()).compareTo(other.isSetTopic());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTopic()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.topic, other.topic);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUniqDelayMsgId()).compareTo(other.isSetUniqDelayMsgId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUniqDelayMsgId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uniqDelayMsgId, other.uniqDelayMsgId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBody()).compareTo(other.isSetBody());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBody()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.body, other.body);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTags()).compareTo(other.isSetTags());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTags()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tags, other.tags);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAction()).compareTo(other.isSetAction());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAction()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, other.action);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDmsgtype()).compareTo(other.isSetDmsgtype());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDmsgtype()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dmsgtype, other.dmsgtype);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetInterval()).compareTo(other.isSetInterval());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetInterval()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.interval, other.interval);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExpire()).compareTo(other.isSetExpire());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpire()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expire, other.expire);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimes()).compareTo(other.isSetTimes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.times, other.times);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetUuid()).compareTo(other.isSetUuid());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUuid()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uuid, other.uuid);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetProperties()).compareTo(other.isSetProperties());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProperties()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.properties, other.properties);
      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("DelayMessage(");
    boolean first = true;

    sb.append("topic:");
    if (this.topic == null) {
      sb.append("null");
    } else {
      sb.append(this.topic);
    }
    first = false;
    if (isSetUniqDelayMsgId()) {
      if (!first) sb.append(", ");
      sb.append("uniqDelayMsgId:");
      if (this.uniqDelayMsgId == null) {
        sb.append("null");
      } else {
        sb.append(this.uniqDelayMsgId);
      }
      first = false;
    }
    if (isSetBody()) {
      if (!first) sb.append(", ");
      sb.append("body:");
      if (this.body == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.body, sb);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("tags:");
    if (this.tags == null) {
      sb.append("null");
    } else {
      sb.append(this.tags);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("action:");
    sb.append(this.action);
    first = false;
    if (isSetTimestamp()) {
      if (!first) sb.append(", ");
      sb.append("timestamp:");
      sb.append(this.timestamp);
      first = false;
    }
    if (isSetDmsgtype()) {
      if (!first) sb.append(", ");
      sb.append("dmsgtype:");
      sb.append(this.dmsgtype);
      first = false;
    }
    if (isSetInterval()) {
      if (!first) sb.append(", ");
      sb.append("interval:");
      sb.append(this.interval);
      first = false;
    }
    if (isSetExpire()) {
      if (!first) sb.append(", ");
      sb.append("expire:");
      sb.append(this.expire);
      first = false;
    }
    if (isSetTimes()) {
      if (!first) sb.append(", ");
      sb.append("times:");
      sb.append(this.times);
      first = false;
    }
    if (isSetUuid()) {
      if (!first) sb.append(", ");
      sb.append("uuid:");
      if (this.uuid == null) {
        sb.append("null");
      } else {
        sb.append(this.uuid);
      }
      first = false;
    }
    if (isSetVersion()) {
      if (!first) sb.append(", ");
      sb.append("version:");
      if (this.version == null) {
        sb.append("null");
      } else {
        sb.append(this.version);
      }
      first = false;
    }
    if (isSetProperties()) {
      if (!first) sb.append(", ");
      sb.append("properties:");
      if (this.properties == null) {
        sb.append("null");
      } else {
        sb.append(this.properties);
      }
      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 DelayMessageStandardSchemeFactory implements SchemeFactory {
    public DelayMessageStandardScheme getScheme() {
      return new DelayMessageStandardScheme();
    }
  }

  private static class DelayMessageStandardScheme extends StandardScheme<DelayMessage> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, DelayMessage 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: // TOPIC
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.topic = iprot.readString();
              struct.setTopicIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // UNIQ_DELAY_MSG_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.uniqDelayMsgId = iprot.readString();
              struct.setUniqDelayMsgIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BODY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.body = iprot.readBinary();
              struct.setBodyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // TAGS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.tags = iprot.readString();
              struct.setTagsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // ACTION
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.action = iprot.readI32();
              struct.setActionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // TIMESTAMP
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timestamp = iprot.readI64();
              struct.setTimestampIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // DMSGTYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.dmsgtype = iprot.readI32();
              struct.setDmsgtypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // INTERVAL
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.interval = iprot.readI64();
              struct.setIntervalIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // EXPIRE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.expire = iprot.readI64();
              struct.setExpireIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // TIMES
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.times = iprot.readI64();
              struct.setTimesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // UUID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.uuid = iprot.readString();
              struct.setUuidIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.version = iprot.readString();
              struct.setVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // PROPERTIES
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map30 = iprot.readMapBegin();
                struct.properties = new HashMap<String,String>(2*_map30.size);
                String _key31;
                String _val32;
                for (int _i33 = 0; _i33 < _map30.size; ++_i33)
                {
                  _key31 = iprot.readString();
                  _val32 = iprot.readString();
                  struct.properties.put(_key31, _val32);
                }
                iprot.readMapEnd();
              }
              struct.setPropertiesIsSet(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, DelayMessage struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.topic != null) {
        oprot.writeFieldBegin(TOPIC_FIELD_DESC);
        oprot.writeString(struct.topic);
        oprot.writeFieldEnd();
      }
      if (struct.uniqDelayMsgId != null) {
        if (struct.isSetUniqDelayMsgId()) {
          oprot.writeFieldBegin(UNIQ_DELAY_MSG_ID_FIELD_DESC);
          oprot.writeString(struct.uniqDelayMsgId);
          oprot.writeFieldEnd();
        }
      }
      if (struct.body != null) {
        if (struct.isSetBody()) {
          oprot.writeFieldBegin(BODY_FIELD_DESC);
          oprot.writeBinary(struct.body);
          oprot.writeFieldEnd();
        }
      }
      if (struct.tags != null) {
        oprot.writeFieldBegin(TAGS_FIELD_DESC);
        oprot.writeString(struct.tags);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(ACTION_FIELD_DESC);
      oprot.writeI32(struct.action);
      oprot.writeFieldEnd();
      if (struct.isSetTimestamp()) {
        oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
        oprot.writeI64(struct.timestamp);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDmsgtype()) {
        oprot.writeFieldBegin(DMSGTYPE_FIELD_DESC);
        oprot.writeI32(struct.dmsgtype);
        oprot.writeFieldEnd();
      }
      if (struct.isSetInterval()) {
        oprot.writeFieldBegin(INTERVAL_FIELD_DESC);
        oprot.writeI64(struct.interval);
        oprot.writeFieldEnd();
      }
      if (struct.isSetExpire()) {
        oprot.writeFieldBegin(EXPIRE_FIELD_DESC);
        oprot.writeI64(struct.expire);
        oprot.writeFieldEnd();
      }
      if (struct.isSetTimes()) {
        oprot.writeFieldBegin(TIMES_FIELD_DESC);
        oprot.writeI64(struct.times);
        oprot.writeFieldEnd();
      }
      if (struct.uuid != null) {
        if (struct.isSetUuid()) {
          oprot.writeFieldBegin(UUID_FIELD_DESC);
          oprot.writeString(struct.uuid);
          oprot.writeFieldEnd();
        }
      }
      if (struct.version != null) {
        if (struct.isSetVersion()) {
          oprot.writeFieldBegin(VERSION_FIELD_DESC);
          oprot.writeString(struct.version);
          oprot.writeFieldEnd();
        }
      }
      if (struct.properties != null) {
        if (struct.isSetProperties()) {
          oprot.writeFieldBegin(PROPERTIES_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.properties.size()));
            for (Map.Entry<String, String> _iter34 : struct.properties.entrySet())
            {
              oprot.writeString(_iter34.getKey());
              oprot.writeString(_iter34.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class DelayMessageTupleSchemeFactory implements SchemeFactory {
    public DelayMessageTupleScheme getScheme() {
      return new DelayMessageTupleScheme();
    }
  }

  private static class DelayMessageTupleScheme extends TupleScheme<DelayMessage> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, DelayMessage struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetTopic()) {
        optionals.set(0);
      }
      if (struct.isSetUniqDelayMsgId()) {
        optionals.set(1);
      }
      if (struct.isSetBody()) {
        optionals.set(2);
      }
      if (struct.isSetTags()) {
        optionals.set(3);
      }
      if (struct.isSetAction()) {
        optionals.set(4);
      }
      if (struct.isSetTimestamp()) {
        optionals.set(5);
      }
      if (struct.isSetDmsgtype()) {
        optionals.set(6);
      }
      if (struct.isSetInterval()) {
        optionals.set(7);
      }
      if (struct.isSetExpire()) {
        optionals.set(8);
      }
      if (struct.isSetTimes()) {
        optionals.set(9);
      }
      if (struct.isSetUuid()) {
        optionals.set(10);
      }
      if (struct.isSetVersion()) {
        optionals.set(11);
      }
      if (struct.isSetProperties()) {
        optionals.set(12);
      }
      oprot.writeBitSet(optionals, 13);
      if (struct.isSetTopic()) {
        oprot.writeString(struct.topic);
      }
      if (struct.isSetUniqDelayMsgId()) {
        oprot.writeString(struct.uniqDelayMsgId);
      }
      if (struct.isSetBody()) {
        oprot.writeBinary(struct.body);
      }
      if (struct.isSetTags()) {
        oprot.writeString(struct.tags);
      }
      if (struct.isSetAction()) {
        oprot.writeI32(struct.action);
      }
      if (struct.isSetTimestamp()) {
        oprot.writeI64(struct.timestamp);
      }
      if (struct.isSetDmsgtype()) {
        oprot.writeI32(struct.dmsgtype);
      }
      if (struct.isSetInterval()) {
        oprot.writeI64(struct.interval);
      }
      if (struct.isSetExpire()) {
        oprot.writeI64(struct.expire);
      }
      if (struct.isSetTimes()) {
        oprot.writeI64(struct.times);
      }
      if (struct.isSetUuid()) {
        oprot.writeString(struct.uuid);
      }
      if (struct.isSetVersion()) {
        oprot.writeString(struct.version);
      }
      if (struct.isSetProperties()) {
        {
          oprot.writeI32(struct.properties.size());
          for (Map.Entry<String, String> _iter35 : struct.properties.entrySet())
          {
            oprot.writeString(_iter35.getKey());
            oprot.writeString(_iter35.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, DelayMessage struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(13);
      if (incoming.get(0)) {
        struct.topic = iprot.readString();
        struct.setTopicIsSet(true);
      }
      if (incoming.get(1)) {
        struct.uniqDelayMsgId = iprot.readString();
        struct.setUniqDelayMsgIdIsSet(true);
      }
      if (incoming.get(2)) {
        struct.body = iprot.readBinary();
        struct.setBodyIsSet(true);
      }
      if (incoming.get(3)) {
        struct.tags = iprot.readString();
        struct.setTagsIsSet(true);
      }
      if (incoming.get(4)) {
        struct.action = iprot.readI32();
        struct.setActionIsSet(true);
      }
      if (incoming.get(5)) {
        struct.timestamp = iprot.readI64();
        struct.setTimestampIsSet(true);
      }
      if (incoming.get(6)) {
        struct.dmsgtype = iprot.readI32();
        struct.setDmsgtypeIsSet(true);
      }
      if (incoming.get(7)) {
        struct.interval = iprot.readI64();
        struct.setIntervalIsSet(true);
      }
      if (incoming.get(8)) {
        struct.expire = iprot.readI64();
        struct.setExpireIsSet(true);
      }
      if (incoming.get(9)) {
        struct.times = iprot.readI64();
        struct.setTimesIsSet(true);
      }
      if (incoming.get(10)) {
        struct.uuid = iprot.readString();
        struct.setUuidIsSet(true);
      }
      if (incoming.get(11)) {
        struct.version = iprot.readString();
        struct.setVersionIsSet(true);
      }
      if (incoming.get(12)) {
        {
          org.apache.thrift.protocol.TMap _map36 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.properties = new HashMap<String,String>(2*_map36.size);
          String _key37;
          String _val38;
          for (int _i39 = 0; _i39 < _map36.size; ++_i39)
          {
            _key37 = iprot.readString();
            _val38 = iprot.readString();
            struct.properties.put(_key37, _val38);
          }
        }
        struct.setPropertiesIsSet(true);
      }
    }
  }

}

