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

tech.aroma.thrift.email.EmailNewApplication 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.email;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-10")
public class EmailNewApplication 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("EmailNewApplication");

  private static final org.apache.thrift.protocol.TField CREATOR_FIELD_DESC = new org.apache.thrift.protocol.TField("creator", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField APP_FIELD_DESC = new org.apache.thrift.protocol.TField("app", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField APP_TOKEN_FIELD_DESC = new org.apache.thrift.protocol.TField("appToken", org.apache.thrift.protocol.TType.STRUCT, (short)3);

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

  public tech.aroma.thrift.User creator; // required
  public tech.aroma.thrift.Application app; // required
  public tech.aroma.thrift.authentication.ApplicationToken appToken; // required

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    CREATOR((short)1, "creator"),
    APP((short)2, "app"),
    APP_TOKEN((short)3, "appToken");

    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: // CREATOR
          return CREATOR;
        case 2: // APP
          return APP;
        case 3: // APP_TOKEN
          return APP_TOKEN;
        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
  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.CREATOR, new org.apache.thrift.meta_data.FieldMetaData("creator", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "User")));
    tmpMap.put(_Fields.APP, new org.apache.thrift.meta_data.FieldMetaData("app", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Application")));
    tmpMap.put(_Fields.APP_TOKEN, new org.apache.thrift.meta_data.FieldMetaData("appToken", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "ApplicationToken")));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(EmailNewApplication.class, metaDataMap);
  }

  public EmailNewApplication() {
  }

  public EmailNewApplication(
    tech.aroma.thrift.User creator,
    tech.aroma.thrift.Application app,
    tech.aroma.thrift.authentication.ApplicationToken appToken)
  {
    this();
    this.creator = creator;
    this.app = app;
    this.appToken = appToken;
  }

  /**
   * Performs a deep copy on other.
   */
  public EmailNewApplication(EmailNewApplication other) {
    if (other.isSetCreator()) {
      this.creator = other.creator;
    }
    if (other.isSetApp()) {
      this.app = other.app;
    }
    if (other.isSetAppToken()) {
      this.appToken = other.appToken;
    }
  }

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

  @Override
  public void clear() {
    this.creator = null;
    this.app = null;
    this.appToken = null;
  }

  public tech.aroma.thrift.User getCreator() {
    return this.creator;
  }

  public EmailNewApplication setCreator(tech.aroma.thrift.User creator) {
    this.creator = creator;
    return this;
  }

  public void unsetCreator() {
    this.creator = null;
  }

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

  public void setCreatorIsSet(boolean value) {
    if (!value) {
      this.creator = null;
    }
  }

  public tech.aroma.thrift.Application getApp() {
    return this.app;
  }

  public EmailNewApplication setApp(tech.aroma.thrift.Application app) {
    this.app = app;
    return this;
  }

  public void unsetApp() {
    this.app = null;
  }

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

  public void setAppIsSet(boolean value) {
    if (!value) {
      this.app = null;
    }
  }

  public tech.aroma.thrift.authentication.ApplicationToken getAppToken() {
    return this.appToken;
  }

  public EmailNewApplication setAppToken(tech.aroma.thrift.authentication.ApplicationToken appToken) {
    this.appToken = appToken;
    return this;
  }

  public void unsetAppToken() {
    this.appToken = null;
  }

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

  public void setAppTokenIsSet(boolean value) {
    if (!value) {
      this.appToken = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case CREATOR:
      if (value == null) {
        unsetCreator();
      } else {
        setCreator((tech.aroma.thrift.User)value);
      }
      break;

    case APP:
      if (value == null) {
        unsetApp();
      } else {
        setApp((tech.aroma.thrift.Application)value);
      }
      break;

    case APP_TOKEN:
      if (value == null) {
        unsetAppToken();
      } else {
        setAppToken((tech.aroma.thrift.authentication.ApplicationToken)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case CREATOR:
      return getCreator();

    case APP:
      return getApp();

    case APP_TOKEN:
      return getAppToken();

    }
    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 CREATOR:
      return isSetCreator();
    case APP:
      return isSetApp();
    case APP_TOKEN:
      return isSetAppToken();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_creator = true && this.isSetCreator();
    boolean that_present_creator = true && that.isSetCreator();
    if (this_present_creator || that_present_creator) {
      if (!(this_present_creator && that_present_creator))
        return false;
      if (!this.creator.equals(that.creator))
        return false;
    }

    boolean this_present_app = true && this.isSetApp();
    boolean that_present_app = true && that.isSetApp();
    if (this_present_app || that_present_app) {
      if (!(this_present_app && that_present_app))
        return false;
      if (!this.app.equals(that.app))
        return false;
    }

    boolean this_present_appToken = true && this.isSetAppToken();
    boolean that_present_appToken = true && that.isSetAppToken();
    if (this_present_appToken || that_present_appToken) {
      if (!(this_present_appToken && that_present_appToken))
        return false;
      if (!this.appToken.equals(that.appToken))
        return false;
    }

    return true;
  }

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

    boolean present_creator = true && (isSetCreator());
    list.add(present_creator);
    if (present_creator)
      list.add(creator);

    boolean present_app = true && (isSetApp());
    list.add(present_app);
    if (present_app)
      list.add(app);

    boolean present_appToken = true && (isSetAppToken());
    list.add(present_appToken);
    if (present_appToken)
      list.add(appToken);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetCreator()).compareTo(other.isSetCreator());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreator()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.creator, other.creator);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetApp()).compareTo(other.isSetApp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.app, other.app);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAppToken()).compareTo(other.isSetAppToken());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAppToken()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.appToken, other.appToken);
      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("EmailNewApplication(");
    boolean first = true;

    sb.append("creator:");
    if (this.creator == null) {
      sb.append("null");
    } else {
      sb.append(this.creator);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("app:");
    if (this.app == null) {
      sb.append("null");
    } else {
      sb.append(this.app);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("appToken:");
    if (this.appToken == null) {
      sb.append("null");
    } else {
      sb.append(this.appToken);
    }
    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 {
      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 EmailNewApplicationStandardSchemeFactory implements SchemeFactory {
    public EmailNewApplicationStandardScheme getScheme() {
      return new EmailNewApplicationStandardScheme();
    }
  }

  private static class EmailNewApplicationStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, EmailNewApplication 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: // CREATOR
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.creator = new tech.aroma.thrift.User();
              struct.creator.read(iprot);
              struct.setCreatorIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // APP
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.app = new tech.aroma.thrift.Application();
              struct.app.read(iprot);
              struct.setAppIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // APP_TOKEN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.appToken = new tech.aroma.thrift.authentication.ApplicationToken();
              struct.appToken.read(iprot);
              struct.setAppTokenIsSet(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, EmailNewApplication struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.creator != null) {
        oprot.writeFieldBegin(CREATOR_FIELD_DESC);
        struct.creator.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.app != null) {
        oprot.writeFieldBegin(APP_FIELD_DESC);
        struct.app.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.appToken != null) {
        oprot.writeFieldBegin(APP_TOKEN_FIELD_DESC);
        struct.appToken.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class EmailNewApplicationTupleSchemeFactory implements SchemeFactory {
    public EmailNewApplicationTupleScheme getScheme() {
      return new EmailNewApplicationTupleScheme();
    }
  }

  private static class EmailNewApplicationTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, EmailNewApplication struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetCreator()) {
        optionals.set(0);
      }
      if (struct.isSetApp()) {
        optionals.set(1);
      }
      if (struct.isSetAppToken()) {
        optionals.set(2);
      }
      oprot.writeBitSet(optionals, 3);
      if (struct.isSetCreator()) {
        struct.creator.write(oprot);
      }
      if (struct.isSetApp()) {
        struct.app.write(oprot);
      }
      if (struct.isSetAppToken()) {
        struct.appToken.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, EmailNewApplication struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(3);
      if (incoming.get(0)) {
        struct.creator = new tech.aroma.thrift.User();
        struct.creator.read(iprot);
        struct.setCreatorIsSet(true);
      }
      if (incoming.get(1)) {
        struct.app = new tech.aroma.thrift.Application();
        struct.app.read(iprot);
        struct.setAppIsSet(true);
      }
      if (incoming.get(2)) {
        struct.appToken = new tech.aroma.thrift.authentication.ApplicationToken();
        struct.appToken.read(iprot);
        struct.setAppTokenIsSet(true);
      }
    }
  }

}