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

tech.aroma.thrift.application.service.SendMessageRequest Maven / Gradle / Ivy

Go to download

Part of the Aroma Project. This project contains the Service and Model Definitions. From this the Server and Client interfaces are generated for the Aroma Service.

There is a newer version: 2.2
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package tech.aroma.thrift.application.service;

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"})
/**
 * Send a Message to Aroma.
 */
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-10")
public class SendMessageRequest 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("SendMessageRequest");

  private static final org.apache.thrift.protocol.TField APPLICATION_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationToken", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  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)2);
  private static final org.apache.thrift.protocol.TField URGENCY_FIELD_DESC = new org.apache.thrift.protocol.TField("urgency", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField TIME_OF_MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("timeOfMessage", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField TITLE_FIELD_DESC = new org.apache.thrift.protocol.TField("title", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField HOSTNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("hostname", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField MAC_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("macAddress", org.apache.thrift.protocol.TType.STRING, (short)7);
  private static final org.apache.thrift.protocol.TField IPV4_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("ipv4Address", org.apache.thrift.protocol.TType.STRING, (short)8);

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

  public tech.aroma.thrift.authentication.ApplicationToken applicationToken; // required
  public String body; // required
  public tech.aroma.thrift.Urgency urgency; // required
  /**
   * The time that the message was generated on the Client Side.
   */
  public long timeOfMessage; // optional
  public String title; // required
  public String hostname; // optional
  public String macAddress; // optional
  public String ipv4Address; // 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 {
    APPLICATION_TOKEN((short)1, "applicationToken"),
    BODY((short)2, "body"),
    URGENCY((short)3, "urgency"),
    /**
     * The time that the message was generated on the Client Side.
     */
    TIME_OF_MESSAGE((short)4, "timeOfMessage"),
    TITLE((short)5, "title"),
    HOSTNAME((short)6, "hostname"),
    MAC_ADDRESS((short)7, "macAddress"),
    IPV4_ADDRESS((short)8, "ipv4Address");

    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: // APPLICATION_TOKEN
          return APPLICATION_TOKEN;
        case 2: // BODY
          return BODY;
        case 3: // URGENCY
          return URGENCY;
        case 4: // TIME_OF_MESSAGE
          return TIME_OF_MESSAGE;
        case 5: // TITLE
          return TITLE;
        case 6: // HOSTNAME
          return HOSTNAME;
        case 7: // MAC_ADDRESS
          return MAC_ADDRESS;
        case 8: // IPV4_ADDRESS
          return IPV4_ADDRESS;
        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 __TIMEOFMESSAGE_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.TIME_OF_MESSAGE,_Fields.HOSTNAME,_Fields.MAC_ADDRESS,_Fields.IPV4_ADDRESS};
  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.APPLICATION_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("applicationToken", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "ApplicationToken")));
    tmpMap.put(_Fields.BODY, new org.apache.thrift.meta_data.FieldMetaData("body", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.URGENCY, new org.apache.thrift.meta_data.FieldMetaData("urgency", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.ENUM        , "Urgency")));
    tmpMap.put(_Fields.TIME_OF_MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("timeOfMessage", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "timestamp")));
    tmpMap.put(_Fields.TITLE, new org.apache.thrift.meta_data.FieldMetaData("title", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.HOSTNAME, new org.apache.thrift.meta_data.FieldMetaData("hostname", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.MAC_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("macAddress", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.IPV4_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("ipv4Address", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SendMessageRequest.class, metaDataMap);
  }

  public SendMessageRequest() {
    this.urgency = tech.aroma.thrift.Urgency.LOW;

  }

  public SendMessageRequest(
    tech.aroma.thrift.authentication.ApplicationToken applicationToken,
    String body,
    tech.aroma.thrift.Urgency urgency,
    String title)
  {
    this();
    this.applicationToken = applicationToken;
    this.body = body;
    this.urgency = urgency;
    this.title = title;
  }

  /**
   * Performs a deep copy on other.
   */
  public SendMessageRequest(SendMessageRequest other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetApplicationToken()) {
      this.applicationToken = other.applicationToken;
    }
    if (other.isSetBody()) {
      this.body = other.body;
    }
    if (other.isSetUrgency()) {
      this.urgency = other.urgency;
    }
    this.timeOfMessage = other.timeOfMessage;
    if (other.isSetTitle()) {
      this.title = other.title;
    }
    if (other.isSetHostname()) {
      this.hostname = other.hostname;
    }
    if (other.isSetMacAddress()) {
      this.macAddress = other.macAddress;
    }
    if (other.isSetIpv4Address()) {
      this.ipv4Address = other.ipv4Address;
    }
  }

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

  @Override
  public void clear() {
    this.applicationToken = null;
    this.body = null;
    this.urgency = tech.aroma.thrift.Urgency.LOW;

    setTimeOfMessageIsSet(false);
    this.timeOfMessage = 0;
    this.title = null;
    this.hostname = null;
    this.macAddress = null;
    this.ipv4Address = null;
  }

  public tech.aroma.thrift.authentication.ApplicationToken getApplicationToken() {
    return this.applicationToken;
  }

  public SendMessageRequest setApplicationToken(tech.aroma.thrift.authentication.ApplicationToken applicationToken) {
    this.applicationToken = applicationToken;
    return this;
  }

  public void unsetApplicationToken() {
    this.applicationToken = null;
  }

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

  public void setApplicationTokenIsSet(boolean value) {
    if (!value) {
      this.applicationToken = null;
    }
  }

  public String getBody() {
    return this.body;
  }

  public SendMessageRequest setBody(String body) {
    this.body = 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 tech.aroma.thrift.Urgency getUrgency() {
    return this.urgency;
  }

  public SendMessageRequest setUrgency(tech.aroma.thrift.Urgency urgency) {
    this.urgency = urgency;
    return this;
  }

  public void unsetUrgency() {
    this.urgency = null;
  }

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

  public void setUrgencyIsSet(boolean value) {
    if (!value) {
      this.urgency = null;
    }
  }

  /**
   * The time that the message was generated on the Client Side.
   */
  public long getTimeOfMessage() {
    return this.timeOfMessage;
  }

  /**
   * The time that the message was generated on the Client Side.
   */
  public SendMessageRequest setTimeOfMessage(long timeOfMessage) {
    this.timeOfMessage = timeOfMessage;
    setTimeOfMessageIsSet(true);
    return this;
  }

  public void unsetTimeOfMessage() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMEOFMESSAGE_ISSET_ID);
  }

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

  public void setTimeOfMessageIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMEOFMESSAGE_ISSET_ID, value);
  }

  public String getTitle() {
    return this.title;
  }

  public SendMessageRequest setTitle(String title) {
    this.title = title;
    return this;
  }

  public void unsetTitle() {
    this.title = null;
  }

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

  public void setTitleIsSet(boolean value) {
    if (!value) {
      this.title = null;
    }
  }

  public String getHostname() {
    return this.hostname;
  }

  public SendMessageRequest setHostname(String hostname) {
    this.hostname = hostname;
    return this;
  }

  public void unsetHostname() {
    this.hostname = null;
  }

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

  public void setHostnameIsSet(boolean value) {
    if (!value) {
      this.hostname = null;
    }
  }

  public String getMacAddress() {
    return this.macAddress;
  }

  public SendMessageRequest setMacAddress(String macAddress) {
    this.macAddress = macAddress;
    return this;
  }

  public void unsetMacAddress() {
    this.macAddress = null;
  }

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

  public void setMacAddressIsSet(boolean value) {
    if (!value) {
      this.macAddress = null;
    }
  }

  public String getIpv4Address() {
    return this.ipv4Address;
  }

  public SendMessageRequest setIpv4Address(String ipv4Address) {
    this.ipv4Address = ipv4Address;
    return this;
  }

  public void unsetIpv4Address() {
    this.ipv4Address = null;
  }

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

  public void setIpv4AddressIsSet(boolean value) {
    if (!value) {
      this.ipv4Address = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case APPLICATION_TOKEN:
      if (value == null) {
        unsetApplicationToken();
      } else {
        setApplicationToken((tech.aroma.thrift.authentication.ApplicationToken)value);
      }
      break;

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

    case URGENCY:
      if (value == null) {
        unsetUrgency();
      } else {
        setUrgency((tech.aroma.thrift.Urgency)value);
      }
      break;

    case TIME_OF_MESSAGE:
      if (value == null) {
        unsetTimeOfMessage();
      } else {
        setTimeOfMessage((Long)value);
      }
      break;

    case TITLE:
      if (value == null) {
        unsetTitle();
      } else {
        setTitle((String)value);
      }
      break;

    case HOSTNAME:
      if (value == null) {
        unsetHostname();
      } else {
        setHostname((String)value);
      }
      break;

    case MAC_ADDRESS:
      if (value == null) {
        unsetMacAddress();
      } else {
        setMacAddress((String)value);
      }
      break;

    case IPV4_ADDRESS:
      if (value == null) {
        unsetIpv4Address();
      } else {
        setIpv4Address((String)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case APPLICATION_TOKEN:
      return getApplicationToken();

    case BODY:
      return getBody();

    case URGENCY:
      return getUrgency();

    case TIME_OF_MESSAGE:
      return getTimeOfMessage();

    case TITLE:
      return getTitle();

    case HOSTNAME:
      return getHostname();

    case MAC_ADDRESS:
      return getMacAddress();

    case IPV4_ADDRESS:
      return getIpv4Address();

    }
    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 APPLICATION_TOKEN:
      return isSetApplicationToken();
    case BODY:
      return isSetBody();
    case URGENCY:
      return isSetUrgency();
    case TIME_OF_MESSAGE:
      return isSetTimeOfMessage();
    case TITLE:
      return isSetTitle();
    case HOSTNAME:
      return isSetHostname();
    case MAC_ADDRESS:
      return isSetMacAddress();
    case IPV4_ADDRESS:
      return isSetIpv4Address();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_applicationToken = true && this.isSetApplicationToken();
    boolean that_present_applicationToken = true && that.isSetApplicationToken();
    if (this_present_applicationToken || that_present_applicationToken) {
      if (!(this_present_applicationToken && that_present_applicationToken))
        return false;
      if (!this.applicationToken.equals(that.applicationToken))
        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_urgency = true && this.isSetUrgency();
    boolean that_present_urgency = true && that.isSetUrgency();
    if (this_present_urgency || that_present_urgency) {
      if (!(this_present_urgency && that_present_urgency))
        return false;
      if (!this.urgency.equals(that.urgency))
        return false;
    }

    boolean this_present_timeOfMessage = true && this.isSetTimeOfMessage();
    boolean that_present_timeOfMessage = true && that.isSetTimeOfMessage();
    if (this_present_timeOfMessage || that_present_timeOfMessage) {
      if (!(this_present_timeOfMessage && that_present_timeOfMessage))
        return false;
      if (this.timeOfMessage != that.timeOfMessage)
        return false;
    }

    boolean this_present_title = true && this.isSetTitle();
    boolean that_present_title = true && that.isSetTitle();
    if (this_present_title || that_present_title) {
      if (!(this_present_title && that_present_title))
        return false;
      if (!this.title.equals(that.title))
        return false;
    }

    boolean this_present_hostname = true && this.isSetHostname();
    boolean that_present_hostname = true && that.isSetHostname();
    if (this_present_hostname || that_present_hostname) {
      if (!(this_present_hostname && that_present_hostname))
        return false;
      if (!this.hostname.equals(that.hostname))
        return false;
    }

    boolean this_present_macAddress = true && this.isSetMacAddress();
    boolean that_present_macAddress = true && that.isSetMacAddress();
    if (this_present_macAddress || that_present_macAddress) {
      if (!(this_present_macAddress && that_present_macAddress))
        return false;
      if (!this.macAddress.equals(that.macAddress))
        return false;
    }

    boolean this_present_ipv4Address = true && this.isSetIpv4Address();
    boolean that_present_ipv4Address = true && that.isSetIpv4Address();
    if (this_present_ipv4Address || that_present_ipv4Address) {
      if (!(this_present_ipv4Address && that_present_ipv4Address))
        return false;
      if (!this.ipv4Address.equals(that.ipv4Address))
        return false;
    }

    return true;
  }

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

    boolean present_applicationToken = true && (isSetApplicationToken());
    list.add(present_applicationToken);
    if (present_applicationToken)
      list.add(applicationToken);

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

    boolean present_urgency = true && (isSetUrgency());
    list.add(present_urgency);
    if (present_urgency)
      list.add(urgency.getValue());

    boolean present_timeOfMessage = true && (isSetTimeOfMessage());
    list.add(present_timeOfMessage);
    if (present_timeOfMessage)
      list.add(timeOfMessage);

    boolean present_title = true && (isSetTitle());
    list.add(present_title);
    if (present_title)
      list.add(title);

    boolean present_hostname = true && (isSetHostname());
    list.add(present_hostname);
    if (present_hostname)
      list.add(hostname);

    boolean present_macAddress = true && (isSetMacAddress());
    list.add(present_macAddress);
    if (present_macAddress)
      list.add(macAddress);

    boolean present_ipv4Address = true && (isSetIpv4Address());
    list.add(present_ipv4Address);
    if (present_ipv4Address)
      list.add(ipv4Address);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetApplicationToken()).compareTo(other.isSetApplicationToken());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApplicationToken()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationToken, other.applicationToken);
      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(isSetUrgency()).compareTo(other.isSetUrgency());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUrgency()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.urgency, other.urgency);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimeOfMessage()).compareTo(other.isSetTimeOfMessage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimeOfMessage()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeOfMessage, other.timeOfMessage);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTitle()).compareTo(other.isSetTitle());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTitle()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.title, other.title);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetHostname()).compareTo(other.isSetHostname());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHostname()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hostname, other.hostname);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetMacAddress()).compareTo(other.isSetMacAddress());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMacAddress()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.macAddress, other.macAddress);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIpv4Address()).compareTo(other.isSetIpv4Address());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIpv4Address()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ipv4Address, other.ipv4Address);
      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("SendMessageRequest(");
    boolean first = true;

    sb.append("applicationToken:");
    if (this.applicationToken == null) {
      sb.append("null");
    } else {
      sb.append(this.applicationToken);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("body:");
    if (this.body == null) {
      sb.append("null");
    } else {
      sb.append(this.body);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("urgency:");
    if (this.urgency == null) {
      sb.append("null");
    } else {
      sb.append(this.urgency);
    }
    first = false;
    if (isSetTimeOfMessage()) {
      if (!first) sb.append(", ");
      sb.append("timeOfMessage:");
      sb.append(this.timeOfMessage);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("title:");
    if (this.title == null) {
      sb.append("null");
    } else {
      sb.append(this.title);
    }
    first = false;
    if (isSetHostname()) {
      if (!first) sb.append(", ");
      sb.append("hostname:");
      if (this.hostname == null) {
        sb.append("null");
      } else {
        sb.append(this.hostname);
      }
      first = false;
    }
    if (isSetMacAddress()) {
      if (!first) sb.append(", ");
      sb.append("macAddress:");
      if (this.macAddress == null) {
        sb.append("null");
      } else {
        sb.append(this.macAddress);
      }
      first = false;
    }
    if (isSetIpv4Address()) {
      if (!first) sb.append(", ");
      sb.append("ipv4Address:");
      if (this.ipv4Address == null) {
        sb.append("null");
      } else {
        sb.append(this.ipv4Address);
      }
      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 SendMessageRequestStandardSchemeFactory implements SchemeFactory {
    public SendMessageRequestStandardScheme getScheme() {
      return new SendMessageRequestStandardScheme();
    }
  }

  private static class SendMessageRequestStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, SendMessageRequest 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: // APPLICATION_TOKEN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.applicationToken = new tech.aroma.thrift.authentication.ApplicationToken();
              struct.applicationToken.read(iprot);
              struct.setApplicationTokenIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // BODY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.body = iprot.readString();
              struct.setBodyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // URGENCY
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.urgency = tech.aroma.thrift.Urgency.findByValue(iprot.readI32());
              struct.setUrgencyIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // TIME_OF_MESSAGE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timeOfMessage = iprot.readI64();
              struct.setTimeOfMessageIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // TITLE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.title = iprot.readString();
              struct.setTitleIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // HOSTNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.hostname = iprot.readString();
              struct.setHostnameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // MAC_ADDRESS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.macAddress = iprot.readString();
              struct.setMacAddressIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // IPV4_ADDRESS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.ipv4Address = iprot.readString();
              struct.setIpv4AddressIsSet(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, SendMessageRequest struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.applicationToken != null) {
        oprot.writeFieldBegin(APPLICATION_TOKEN_FIELD_DESC);
        struct.applicationToken.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.body != null) {
        oprot.writeFieldBegin(BODY_FIELD_DESC);
        oprot.writeString(struct.body);
        oprot.writeFieldEnd();
      }
      if (struct.urgency != null) {
        oprot.writeFieldBegin(URGENCY_FIELD_DESC);
        oprot.writeI32(struct.urgency.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.isSetTimeOfMessage()) {
        oprot.writeFieldBegin(TIME_OF_MESSAGE_FIELD_DESC);
        oprot.writeI64(struct.timeOfMessage);
        oprot.writeFieldEnd();
      }
      if (struct.title != null) {
        oprot.writeFieldBegin(TITLE_FIELD_DESC);
        oprot.writeString(struct.title);
        oprot.writeFieldEnd();
      }
      if (struct.hostname != null) {
        if (struct.isSetHostname()) {
          oprot.writeFieldBegin(HOSTNAME_FIELD_DESC);
          oprot.writeString(struct.hostname);
          oprot.writeFieldEnd();
        }
      }
      if (struct.macAddress != null) {
        if (struct.isSetMacAddress()) {
          oprot.writeFieldBegin(MAC_ADDRESS_FIELD_DESC);
          oprot.writeString(struct.macAddress);
          oprot.writeFieldEnd();
        }
      }
      if (struct.ipv4Address != null) {
        if (struct.isSetIpv4Address()) {
          oprot.writeFieldBegin(IPV4_ADDRESS_FIELD_DESC);
          oprot.writeString(struct.ipv4Address);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class SendMessageRequestTupleSchemeFactory implements SchemeFactory {
    public SendMessageRequestTupleScheme getScheme() {
      return new SendMessageRequestTupleScheme();
    }
  }

  private static class SendMessageRequestTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, SendMessageRequest struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetApplicationToken()) {
        optionals.set(0);
      }
      if (struct.isSetBody()) {
        optionals.set(1);
      }
      if (struct.isSetUrgency()) {
        optionals.set(2);
      }
      if (struct.isSetTimeOfMessage()) {
        optionals.set(3);
      }
      if (struct.isSetTitle()) {
        optionals.set(4);
      }
      if (struct.isSetHostname()) {
        optionals.set(5);
      }
      if (struct.isSetMacAddress()) {
        optionals.set(6);
      }
      if (struct.isSetIpv4Address()) {
        optionals.set(7);
      }
      oprot.writeBitSet(optionals, 8);
      if (struct.isSetApplicationToken()) {
        struct.applicationToken.write(oprot);
      }
      if (struct.isSetBody()) {
        oprot.writeString(struct.body);
      }
      if (struct.isSetUrgency()) {
        oprot.writeI32(struct.urgency.getValue());
      }
      if (struct.isSetTimeOfMessage()) {
        oprot.writeI64(struct.timeOfMessage);
      }
      if (struct.isSetTitle()) {
        oprot.writeString(struct.title);
      }
      if (struct.isSetHostname()) {
        oprot.writeString(struct.hostname);
      }
      if (struct.isSetMacAddress()) {
        oprot.writeString(struct.macAddress);
      }
      if (struct.isSetIpv4Address()) {
        oprot.writeString(struct.ipv4Address);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, SendMessageRequest struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(8);
      if (incoming.get(0)) {
        struct.applicationToken = new tech.aroma.thrift.authentication.ApplicationToken();
        struct.applicationToken.read(iprot);
        struct.setApplicationTokenIsSet(true);
      }
      if (incoming.get(1)) {
        struct.body = iprot.readString();
        struct.setBodyIsSet(true);
      }
      if (incoming.get(2)) {
        struct.urgency = tech.aroma.thrift.Urgency.findByValue(iprot.readI32());
        struct.setUrgencyIsSet(true);
      }
      if (incoming.get(3)) {
        struct.timeOfMessage = iprot.readI64();
        struct.setTimeOfMessageIsSet(true);
      }
      if (incoming.get(4)) {
        struct.title = iprot.readString();
        struct.setTitleIsSet(true);
      }
      if (incoming.get(5)) {
        struct.hostname = iprot.readString();
        struct.setHostnameIsSet(true);
      }
      if (incoming.get(6)) {
        struct.macAddress = iprot.readString();
        struct.setMacAddressIsSet(true);
      }
      if (incoming.get(7)) {
        struct.ipv4Address = iprot.readString();
        struct.setIpv4AddressIsSet(true);
      }
    }
  }

}