Subversion Repositories SmartDukaan

Rev

Rev 1178 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.model.v1.user;

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.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

public class UserCommunication implements TBase<UserCommunication._Fields>, java.io.Serializable, Cloneable, Comparable<UserCommunication> {
  private static final TStruct STRUCT_DESC = new TStruct("UserCommunication");

  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)2);
  private static final TField COMMUNICATION_TYPE_FIELD_DESC = new TField("communicationType", TType.I32, (short)3);
  private static final TField ORDER_ID_FIELD_DESC = new TField("orderId", TType.I64, (short)4);
  private static final TField AIRWAYBILL_NO_FIELD_DESC = new TField("airwaybillNo", TType.STRING, (short)5);
  private static final TField REPLY_TO_FIELD_DESC = new TField("replyTo", TType.STRING, (short)6);
  private static final TField PRODUCT_NAME_FIELD_DESC = new TField("productName", TType.STRING, (short)7);
  private static final TField SUBJECT_FIELD_DESC = new TField("subject", TType.STRING, (short)8);
  private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)9);
  private static final TField COMMUNICATION_TIMESTAMP_FIELD_DESC = new TField("communication_timestamp", TType.I64, (short)10);

  private long id;
  private long userId;
  private UserCommunicationType communicationType;
  private long orderId;
  private String airwaybillNo;
  private String replyTo;
  private String productName;
  private String subject;
  private String message;
  private long communication_timestamp;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    ID((short)1, "id"),
    USER_ID((short)2, "userId"),
    /**
     * 
     * @see UserCommunicationType
     */
    COMMUNICATION_TYPE((short)3, "communicationType"),
    ORDER_ID((short)4, "orderId"),
    AIRWAYBILL_NO((short)5, "airwaybillNo"),
    REPLY_TO((short)6, "replyTo"),
    PRODUCT_NAME((short)7, "productName"),
    SUBJECT((short)8, "subject"),
    MESSAGE((short)9, "message"),
    COMMUNICATION_TIMESTAMP((short)10, "communication_timestamp");

    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byId.put((int)field._thriftId, field);
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * 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 __ID_ISSET_ID = 0;
  private static final int __USERID_ISSET_ID = 1;
  private static final int __ORDERID_ISSET_ID = 2;
  private static final int __COMMUNICATION_TIMESTAMP_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.COMMUNICATION_TYPE, new FieldMetaData("communicationType", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, UserCommunicationType.class)));
    put(_Fields.ORDER_ID, new FieldMetaData("orderId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.AIRWAYBILL_NO, new FieldMetaData("airwaybillNo", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.REPLY_TO, new FieldMetaData("replyTo", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.PRODUCT_NAME, new FieldMetaData("productName", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SUBJECT, new FieldMetaData("subject", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.COMMUNICATION_TIMESTAMP, new FieldMetaData("communication_timestamp", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(UserCommunication.class, metaDataMap);
  }

  public UserCommunication() {
  }

  public UserCommunication(
    long id,
    long userId,
    UserCommunicationType communicationType,
    long orderId,
    String airwaybillNo,
    String replyTo,
    String productName,
    String subject,
    String message,
    long communication_timestamp)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.userId = userId;
    setUserIdIsSet(true);
    this.communicationType = communicationType;
    this.orderId = orderId;
    setOrderIdIsSet(true);
    this.airwaybillNo = airwaybillNo;
    this.replyTo = replyTo;
    this.productName = productName;
    this.subject = subject;
    this.message = message;
    this.communication_timestamp = communication_timestamp;
    setCommunication_timestampIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public UserCommunication(UserCommunication other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.userId = other.userId;
    if (other.isSetCommunicationType()) {
      this.communicationType = other.communicationType;
    }
    this.orderId = other.orderId;
    if (other.isSetAirwaybillNo()) {
      this.airwaybillNo = other.airwaybillNo;
    }
    if (other.isSetReplyTo()) {
      this.replyTo = other.replyTo;
    }
    if (other.isSetProductName()) {
      this.productName = other.productName;
    }
    if (other.isSetSubject()) {
      this.subject = other.subject;
    }
    if (other.isSetMessage()) {
      this.message = other.message;
    }
    this.communication_timestamp = other.communication_timestamp;
  }

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

  @Deprecated
  public UserCommunication clone() {
    return new UserCommunication(this);
  }

  public long getId() {
    return this.id;
  }

  public UserCommunication setId(long id) {
    this.id = id;
    setIdIsSet(true);
    return this;
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been asigned a value) and false otherwise */
  public boolean isSetId() {
    return __isset_bit_vector.get(__ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

  public long getUserId() {
    return this.userId;
  }

  public UserCommunication setUserId(long userId) {
    this.userId = userId;
    setUserIdIsSet(true);
    return this;
  }

  public void unsetUserId() {
    __isset_bit_vector.clear(__USERID_ISSET_ID);
  }

  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
  public boolean isSetUserId() {
    return __isset_bit_vector.get(__USERID_ISSET_ID);
  }

  public void setUserIdIsSet(boolean value) {
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
  }

  /**
   * 
   * @see UserCommunicationType
   */
  public UserCommunicationType getCommunicationType() {
    return this.communicationType;
  }

  /**
   * 
   * @see UserCommunicationType
   */
  public UserCommunication setCommunicationType(UserCommunicationType communicationType) {
    this.communicationType = communicationType;
    return this;
  }

  public void unsetCommunicationType() {
    this.communicationType = null;
  }

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

  public void setCommunicationTypeIsSet(boolean value) {
    if (!value) {
      this.communicationType = null;
    }
  }

  public long getOrderId() {
    return this.orderId;
  }

  public UserCommunication setOrderId(long orderId) {
    this.orderId = orderId;
    setOrderIdIsSet(true);
    return this;
  }

  public void unsetOrderId() {
    __isset_bit_vector.clear(__ORDERID_ISSET_ID);
  }

  /** Returns true if field orderId is set (has been asigned a value) and false otherwise */
  public boolean isSetOrderId() {
    return __isset_bit_vector.get(__ORDERID_ISSET_ID);
  }

  public void setOrderIdIsSet(boolean value) {
    __isset_bit_vector.set(__ORDERID_ISSET_ID, value);
  }

  public String getAirwaybillNo() {
    return this.airwaybillNo;
  }

  public UserCommunication setAirwaybillNo(String airwaybillNo) {
    this.airwaybillNo = airwaybillNo;
    return this;
  }

  public void unsetAirwaybillNo() {
    this.airwaybillNo = null;
  }

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

  public void setAirwaybillNoIsSet(boolean value) {
    if (!value) {
      this.airwaybillNo = null;
    }
  }

  public String getReplyTo() {
    return this.replyTo;
  }

  public UserCommunication setReplyTo(String replyTo) {
    this.replyTo = replyTo;
    return this;
  }

  public void unsetReplyTo() {
    this.replyTo = null;
  }

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

  public void setReplyToIsSet(boolean value) {
    if (!value) {
      this.replyTo = null;
    }
  }

  public String getProductName() {
    return this.productName;
  }

  public UserCommunication setProductName(String productName) {
    this.productName = productName;
    return this;
  }

  public void unsetProductName() {
    this.productName = null;
  }

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

  public void setProductNameIsSet(boolean value) {
    if (!value) {
      this.productName = null;
    }
  }

  public String getSubject() {
    return this.subject;
  }

  public UserCommunication setSubject(String subject) {
    this.subject = subject;
    return this;
  }

  public void unsetSubject() {
    this.subject = null;
  }

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

  public void setSubjectIsSet(boolean value) {
    if (!value) {
      this.subject = null;
    }
  }

  public String getMessage() {
    return this.message;
  }

  public UserCommunication setMessage(String message) {
    this.message = message;
    return this;
  }

  public void unsetMessage() {
    this.message = null;
  }

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

  public void setMessageIsSet(boolean value) {
    if (!value) {
      this.message = null;
    }
  }

  public long getCommunication_timestamp() {
    return this.communication_timestamp;
  }

  public UserCommunication setCommunication_timestamp(long communication_timestamp) {
    this.communication_timestamp = communication_timestamp;
    setCommunication_timestampIsSet(true);
    return this;
  }

  public void unsetCommunication_timestamp() {
    __isset_bit_vector.clear(__COMMUNICATION_TIMESTAMP_ISSET_ID);
  }

  /** Returns true if field communication_timestamp is set (has been asigned a value) and false otherwise */
  public boolean isSetCommunication_timestamp() {
    return __isset_bit_vector.get(__COMMUNICATION_TIMESTAMP_ISSET_ID);
  }

  public void setCommunication_timestampIsSet(boolean value) {
    __isset_bit_vector.set(__COMMUNICATION_TIMESTAMP_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((Long)value);
      }
      break;

    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case COMMUNICATION_TYPE:
      if (value == null) {
        unsetCommunicationType();
      } else {
        setCommunicationType((UserCommunicationType)value);
      }
      break;

    case ORDER_ID:
      if (value == null) {
        unsetOrderId();
      } else {
        setOrderId((Long)value);
      }
      break;

    case AIRWAYBILL_NO:
      if (value == null) {
        unsetAirwaybillNo();
      } else {
        setAirwaybillNo((String)value);
      }
      break;

    case REPLY_TO:
      if (value == null) {
        unsetReplyTo();
      } else {
        setReplyTo((String)value);
      }
      break;

    case PRODUCT_NAME:
      if (value == null) {
        unsetProductName();
      } else {
        setProductName((String)value);
      }
      break;

    case SUBJECT:
      if (value == null) {
        unsetSubject();
      } else {
        setSubject((String)value);
      }
      break;

    case MESSAGE:
      if (value == null) {
        unsetMessage();
      } else {
        setMessage((String)value);
      }
      break;

    case COMMUNICATION_TIMESTAMP:
      if (value == null) {
        unsetCommunication_timestamp();
      } else {
        setCommunication_timestamp((Long)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return new Long(getId());

    case USER_ID:
      return new Long(getUserId());

    case COMMUNICATION_TYPE:
      return getCommunicationType();

    case ORDER_ID:
      return new Long(getOrderId());

    case AIRWAYBILL_NO:
      return getAirwaybillNo();

    case REPLY_TO:
      return getReplyTo();

    case PRODUCT_NAME:
      return getProductName();

    case SUBJECT:
      return getSubject();

    case MESSAGE:
      return getMessage();

    case COMMUNICATION_TIMESTAMP:
      return new Long(getCommunication_timestamp());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case ID:
      return isSetId();
    case USER_ID:
      return isSetUserId();
    case COMMUNICATION_TYPE:
      return isSetCommunicationType();
    case ORDER_ID:
      return isSetOrderId();
    case AIRWAYBILL_NO:
      return isSetAirwaybillNo();
    case REPLY_TO:
      return isSetReplyTo();
    case PRODUCT_NAME:
      return isSetProductName();
    case SUBJECT:
      return isSetSubject();
    case MESSAGE:
      return isSetMessage();
    case COMMUNICATION_TIMESTAMP:
      return isSetCommunication_timestamp();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

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

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

    boolean this_present_id = true;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_userId = true;
    boolean that_present_userId = true;
    if (this_present_userId || that_present_userId) {
      if (!(this_present_userId && that_present_userId))
        return false;
      if (this.userId != that.userId)
        return false;
    }

    boolean this_present_communicationType = true && this.isSetCommunicationType();
    boolean that_present_communicationType = true && that.isSetCommunicationType();
    if (this_present_communicationType || that_present_communicationType) {
      if (!(this_present_communicationType && that_present_communicationType))
        return false;
      if (!this.communicationType.equals(that.communicationType))
        return false;
    }

    boolean this_present_orderId = true;
    boolean that_present_orderId = true;
    if (this_present_orderId || that_present_orderId) {
      if (!(this_present_orderId && that_present_orderId))
        return false;
      if (this.orderId != that.orderId)
        return false;
    }

    boolean this_present_airwaybillNo = true && this.isSetAirwaybillNo();
    boolean that_present_airwaybillNo = true && that.isSetAirwaybillNo();
    if (this_present_airwaybillNo || that_present_airwaybillNo) {
      if (!(this_present_airwaybillNo && that_present_airwaybillNo))
        return false;
      if (!this.airwaybillNo.equals(that.airwaybillNo))
        return false;
    }

    boolean this_present_replyTo = true && this.isSetReplyTo();
    boolean that_present_replyTo = true && that.isSetReplyTo();
    if (this_present_replyTo || that_present_replyTo) {
      if (!(this_present_replyTo && that_present_replyTo))
        return false;
      if (!this.replyTo.equals(that.replyTo))
        return false;
    }

    boolean this_present_productName = true && this.isSetProductName();
    boolean that_present_productName = true && that.isSetProductName();
    if (this_present_productName || that_present_productName) {
      if (!(this_present_productName && that_present_productName))
        return false;
      if (!this.productName.equals(that.productName))
        return false;
    }

    boolean this_present_subject = true && this.isSetSubject();
    boolean that_present_subject = true && that.isSetSubject();
    if (this_present_subject || that_present_subject) {
      if (!(this_present_subject && that_present_subject))
        return false;
      if (!this.subject.equals(that.subject))
        return false;
    }

    boolean this_present_message = true && this.isSetMessage();
    boolean that_present_message = true && that.isSetMessage();
    if (this_present_message || that_present_message) {
      if (!(this_present_message && that_present_message))
        return false;
      if (!this.message.equals(that.message))
        return false;
    }

    boolean this_present_communication_timestamp = true;
    boolean that_present_communication_timestamp = true;
    if (this_present_communication_timestamp || that_present_communication_timestamp) {
      if (!(this_present_communication_timestamp && that_present_communication_timestamp))
        return false;
      if (this.communication_timestamp != that.communication_timestamp)
        return false;
    }

    return true;
  }

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

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

    int lastComparison = 0;
    UserCommunication typedOther = (UserCommunication)other;

    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCommunicationType()).compareTo(isSetCommunicationType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(communicationType, typedOther.communicationType);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetOrderId()).compareTo(isSetOrderId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(orderId, typedOther.orderId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAirwaybillNo()).compareTo(isSetAirwaybillNo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(airwaybillNo, typedOther.airwaybillNo);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetReplyTo()).compareTo(isSetReplyTo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(replyTo, typedOther.replyTo);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetProductName()).compareTo(isSetProductName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(productName, typedOther.productName);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetSubject()).compareTo(isSetSubject());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(subject, typedOther.subject);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMessage()).compareTo(isSetMessage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(message, typedOther.message);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCommunication_timestamp()).compareTo(isSetCommunication_timestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(communication_timestamp, typedOther.communication_timestamp);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case ID:
            if (field.type == TType.I64) {
              this.id = iprot.readI64();
              setIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case USER_ID:
            if (field.type == TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case COMMUNICATION_TYPE:
            if (field.type == TType.I32) {
              this.communicationType = UserCommunicationType.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ORDER_ID:
            if (field.type == TType.I64) {
              this.orderId = iprot.readI64();
              setOrderIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case AIRWAYBILL_NO:
            if (field.type == TType.STRING) {
              this.airwaybillNo = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case REPLY_TO:
            if (field.type == TType.STRING) {
              this.replyTo = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PRODUCT_NAME:
            if (field.type == TType.STRING) {
              this.productName = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SUBJECT:
            if (field.type == TType.STRING) {
              this.subject = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case MESSAGE:
            if (field.type == TType.STRING) {
              this.message = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case COMMUNICATION_TIMESTAMP:
            if (field.type == TType.I64) {
              this.communication_timestamp = iprot.readI64();
              setCommunication_timestampIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    if (this.communicationType != null) {
      oprot.writeFieldBegin(COMMUNICATION_TYPE_FIELD_DESC);
      oprot.writeI32(this.communicationType.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
    oprot.writeI64(this.orderId);
    oprot.writeFieldEnd();
    if (this.airwaybillNo != null) {
      oprot.writeFieldBegin(AIRWAYBILL_NO_FIELD_DESC);
      oprot.writeString(this.airwaybillNo);
      oprot.writeFieldEnd();
    }
    if (this.replyTo != null) {
      oprot.writeFieldBegin(REPLY_TO_FIELD_DESC);
      oprot.writeString(this.replyTo);
      oprot.writeFieldEnd();
    }
    if (this.productName != null) {
      oprot.writeFieldBegin(PRODUCT_NAME_FIELD_DESC);
      oprot.writeString(this.productName);
      oprot.writeFieldEnd();
    }
    if (this.subject != null) {
      oprot.writeFieldBegin(SUBJECT_FIELD_DESC);
      oprot.writeString(this.subject);
      oprot.writeFieldEnd();
    }
    if (this.message != null) {
      oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
      oprot.writeString(this.message);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(COMMUNICATION_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.communication_timestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("UserCommunication(");
    boolean first = true;

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("communicationType:");
    if (this.communicationType == null) {
      sb.append("null");
    } else {
      String communicationType_name = communicationType.name();
      if (communicationType_name != null) {
        sb.append(communicationType_name);
        sb.append(" (");
      }
      sb.append(this.communicationType);
      if (communicationType_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("orderId:");
    sb.append(this.orderId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("airwaybillNo:");
    if (this.airwaybillNo == null) {
      sb.append("null");
    } else {
      sb.append(this.airwaybillNo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("replyTo:");
    if (this.replyTo == null) {
      sb.append("null");
    } else {
      sb.append(this.replyTo);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("productName:");
    if (this.productName == null) {
      sb.append("null");
    } else {
      sb.append(this.productName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("subject:");
    if (this.subject == null) {
      sb.append("null");
    } else {
      sb.append(this.subject);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("message:");
    if (this.message == null) {
      sb.append("null");
    } else {
      sb.append(this.message);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("communication_timestamp:");
    sb.append(this.communication_timestamp);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}