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

tech.aroma.thrift.channels.AromaChannel 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.channels;

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"})
/**
 * This Union represents the Abstract concept of an AromaChannel
 */
public class AromaChannel extends org.apache.thrift.TUnion {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AromaChannel");
  private static final org.apache.thrift.protocol.TField SLACK_CHANNEL_FIELD_DESC = new org.apache.thrift.protocol.TField("slackChannel", org.apache.thrift.protocol.TType.STRUCT, (short)1);
  private static final org.apache.thrift.protocol.TField SLACK_USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("slackUsername", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("email", org.apache.thrift.protocol.TType.STRUCT, (short)3);
  private static final org.apache.thrift.protocol.TField CUSTOM_CHANNEL_FIELD_DESC = new org.apache.thrift.protocol.TField("customChannel", org.apache.thrift.protocol.TType.STRUCT, (short)4);
  private static final org.apache.thrift.protocol.TField IOS_DEVICE_FIELD_DESC = new org.apache.thrift.protocol.TField("iosDevice", org.apache.thrift.protocol.TType.STRUCT, (short)5);
  private static final org.apache.thrift.protocol.TField ANDROID_DEVICE_FIELD_DESC = new org.apache.thrift.protocol.TField("androidDevice", org.apache.thrift.protocol.TType.STRUCT, (short)6);

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    SLACK_CHANNEL((short)1, "slackChannel"),
    SLACK_USERNAME((short)2, "slackUsername"),
    EMAIL((short)3, "email"),
    CUSTOM_CHANNEL((short)4, "customChannel"),
    IOS_DEVICE((short)5, "iosDevice"),
    ANDROID_DEVICE((short)6, "androidDevice");

    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: // SLACK_CHANNEL
          return SLACK_CHANNEL;
        case 2: // SLACK_USERNAME
          return SLACK_USERNAME;
        case 3: // EMAIL
          return EMAIL;
        case 4: // CUSTOM_CHANNEL
          return CUSTOM_CHANNEL;
        case 5: // IOS_DEVICE
          return IOS_DEVICE;
        case 6: // ANDROID_DEVICE
          return ANDROID_DEVICE;
        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;
    }
  }

  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.SLACK_CHANNEL, new org.apache.thrift.meta_data.FieldMetaData("slackChannel", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SlackChannel.class)));
    tmpMap.put(_Fields.SLACK_USERNAME, new org.apache.thrift.meta_data.FieldMetaData("slackUsername", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SlackUsername.class)));
    tmpMap.put(_Fields.EMAIL, new org.apache.thrift.meta_data.FieldMetaData("email", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Email.class)));
    tmpMap.put(_Fields.CUSTOM_CHANNEL, new org.apache.thrift.meta_data.FieldMetaData("customChannel", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, CustomChannel.class)));
    tmpMap.put(_Fields.IOS_DEVICE, new org.apache.thrift.meta_data.FieldMetaData("iosDevice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, IOSDevice.class)));
    tmpMap.put(_Fields.ANDROID_DEVICE, new org.apache.thrift.meta_data.FieldMetaData("androidDevice", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, AndroidDevice.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AromaChannel.class, metaDataMap);
  }

  public AromaChannel() {
    super();
  }

  public AromaChannel(_Fields setField, Object value) {
    super(setField, value);
  }

  public AromaChannel(AromaChannel other) {
    super(other);
  }
  public AromaChannel deepCopy() {
    return new AromaChannel(this);
  }

  public static AromaChannel slackChannel(SlackChannel value) {
    AromaChannel x = new AromaChannel();
    x.setSlackChannel(value);
    return x;
  }

  public static AromaChannel slackUsername(SlackUsername value) {
    AromaChannel x = new AromaChannel();
    x.setSlackUsername(value);
    return x;
  }

  public static AromaChannel email(Email value) {
    AromaChannel x = new AromaChannel();
    x.setEmail(value);
    return x;
  }

  public static AromaChannel customChannel(CustomChannel value) {
    AromaChannel x = new AromaChannel();
    x.setCustomChannel(value);
    return x;
  }

  public static AromaChannel iosDevice(IOSDevice value) {
    AromaChannel x = new AromaChannel();
    x.setIosDevice(value);
    return x;
  }

  public static AromaChannel androidDevice(AndroidDevice value) {
    AromaChannel x = new AromaChannel();
    x.setAndroidDevice(value);
    return x;
  }


  @Override
  protected void checkType(_Fields setField, Object value) throws ClassCastException {
    switch (setField) {
      case SLACK_CHANNEL:
        if (value instanceof SlackChannel) {
          break;
        }
        throw new ClassCastException("Was expecting value of type SlackChannel for field 'slackChannel', but got " + value.getClass().getSimpleName());
      case SLACK_USERNAME:
        if (value instanceof SlackUsername) {
          break;
        }
        throw new ClassCastException("Was expecting value of type SlackUsername for field 'slackUsername', but got " + value.getClass().getSimpleName());
      case EMAIL:
        if (value instanceof Email) {
          break;
        }
        throw new ClassCastException("Was expecting value of type Email for field 'email', but got " + value.getClass().getSimpleName());
      case CUSTOM_CHANNEL:
        if (value instanceof CustomChannel) {
          break;
        }
        throw new ClassCastException("Was expecting value of type CustomChannel for field 'customChannel', but got " + value.getClass().getSimpleName());
      case IOS_DEVICE:
        if (value instanceof IOSDevice) {
          break;
        }
        throw new ClassCastException("Was expecting value of type IOSDevice for field 'iosDevice', but got " + value.getClass().getSimpleName());
      case ANDROID_DEVICE:
        if (value instanceof AndroidDevice) {
          break;
        }
        throw new ClassCastException("Was expecting value of type AndroidDevice for field 'androidDevice', but got " + value.getClass().getSimpleName());
      default:
        throw new IllegalArgumentException("Unknown field id " + setField);
    }
  }

  @Override
  protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(field.id);
    if (setField != null) {
      switch (setField) {
        case SLACK_CHANNEL:
          if (field.type == SLACK_CHANNEL_FIELD_DESC.type) {
            SlackChannel slackChannel;
            slackChannel = new SlackChannel();
            slackChannel.read(iprot);
            return slackChannel;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case SLACK_USERNAME:
          if (field.type == SLACK_USERNAME_FIELD_DESC.type) {
            SlackUsername slackUsername;
            slackUsername = new SlackUsername();
            slackUsername.read(iprot);
            return slackUsername;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case EMAIL:
          if (field.type == EMAIL_FIELD_DESC.type) {
            Email email;
            email = new Email();
            email.read(iprot);
            return email;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case CUSTOM_CHANNEL:
          if (field.type == CUSTOM_CHANNEL_FIELD_DESC.type) {
            CustomChannel customChannel;
            customChannel = new CustomChannel();
            customChannel.read(iprot);
            return customChannel;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case IOS_DEVICE:
          if (field.type == IOS_DEVICE_FIELD_DESC.type) {
            IOSDevice iosDevice;
            iosDevice = new IOSDevice();
            iosDevice.read(iprot);
            return iosDevice;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        case ANDROID_DEVICE:
          if (field.type == ANDROID_DEVICE_FIELD_DESC.type) {
            AndroidDevice androidDevice;
            androidDevice = new AndroidDevice();
            androidDevice.read(iprot);
            return androidDevice;
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
            return null;
          }
        default:
          throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
      }
    } else {
      org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      return null;
    }
  }

  @Override
  protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    switch (setField_) {
      case SLACK_CHANNEL:
        SlackChannel slackChannel = (SlackChannel)value_;
        slackChannel.write(oprot);
        return;
      case SLACK_USERNAME:
        SlackUsername slackUsername = (SlackUsername)value_;
        slackUsername.write(oprot);
        return;
      case EMAIL:
        Email email = (Email)value_;
        email.write(oprot);
        return;
      case CUSTOM_CHANNEL:
        CustomChannel customChannel = (CustomChannel)value_;
        customChannel.write(oprot);
        return;
      case IOS_DEVICE:
        IOSDevice iosDevice = (IOSDevice)value_;
        iosDevice.write(oprot);
        return;
      case ANDROID_DEVICE:
        AndroidDevice androidDevice = (AndroidDevice)value_;
        androidDevice.write(oprot);
        return;
      default:
        throw new IllegalStateException("Cannot write union with unknown field " + setField_);
    }
  }

  @Override
  protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(fieldID);
    if (setField != null) {
      switch (setField) {
        case SLACK_CHANNEL:
          SlackChannel slackChannel;
          slackChannel = new SlackChannel();
          slackChannel.read(iprot);
          return slackChannel;
        case SLACK_USERNAME:
          SlackUsername slackUsername;
          slackUsername = new SlackUsername();
          slackUsername.read(iprot);
          return slackUsername;
        case EMAIL:
          Email email;
          email = new Email();
          email.read(iprot);
          return email;
        case CUSTOM_CHANNEL:
          CustomChannel customChannel;
          customChannel = new CustomChannel();
          customChannel.read(iprot);
          return customChannel;
        case IOS_DEVICE:
          IOSDevice iosDevice;
          iosDevice = new IOSDevice();
          iosDevice.read(iprot);
          return iosDevice;
        case ANDROID_DEVICE:
          AndroidDevice androidDevice;
          androidDevice = new AndroidDevice();
          androidDevice.read(iprot);
          return androidDevice;
        default:
          throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
      }
    } else {
      throw new TProtocolException("Couldn't find a field with field id " + fieldID);
    }
  }

  @Override
  protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    switch (setField_) {
      case SLACK_CHANNEL:
        SlackChannel slackChannel = (SlackChannel)value_;
        slackChannel.write(oprot);
        return;
      case SLACK_USERNAME:
        SlackUsername slackUsername = (SlackUsername)value_;
        slackUsername.write(oprot);
        return;
      case EMAIL:
        Email email = (Email)value_;
        email.write(oprot);
        return;
      case CUSTOM_CHANNEL:
        CustomChannel customChannel = (CustomChannel)value_;
        customChannel.write(oprot);
        return;
      case IOS_DEVICE:
        IOSDevice iosDevice = (IOSDevice)value_;
        iosDevice.write(oprot);
        return;
      case ANDROID_DEVICE:
        AndroidDevice androidDevice = (AndroidDevice)value_;
        androidDevice.write(oprot);
        return;
      default:
        throw new IllegalStateException("Cannot write union with unknown field " + setField_);
    }
  }

  @Override
  protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
    switch (setField) {
      case SLACK_CHANNEL:
        return SLACK_CHANNEL_FIELD_DESC;
      case SLACK_USERNAME:
        return SLACK_USERNAME_FIELD_DESC;
      case EMAIL:
        return EMAIL_FIELD_DESC;
      case CUSTOM_CHANNEL:
        return CUSTOM_CHANNEL_FIELD_DESC;
      case IOS_DEVICE:
        return IOS_DEVICE_FIELD_DESC;
      case ANDROID_DEVICE:
        return ANDROID_DEVICE_FIELD_DESC;
      default:
        throw new IllegalArgumentException("Unknown field id " + setField);
    }
  }

  @Override
  protected org.apache.thrift.protocol.TStruct getStructDesc() {
    return STRUCT_DESC;
  }

  @Override
  protected _Fields enumForId(short id) {
    return _Fields.findByThriftIdOrThrow(id);
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }


  public SlackChannel getSlackChannel() {
    if (getSetField() == _Fields.SLACK_CHANNEL) {
      return (SlackChannel)getFieldValue();
    } else {
      throw new RuntimeException("Cannot get field 'slackChannel' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setSlackChannel(SlackChannel value) {
    if (value == null) throw new NullPointerException();
    setField_ = _Fields.SLACK_CHANNEL;
    value_ = value;
  }

  public SlackUsername getSlackUsername() {
    if (getSetField() == _Fields.SLACK_USERNAME) {
      return (SlackUsername)getFieldValue();
    } else {
      throw new RuntimeException("Cannot get field 'slackUsername' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setSlackUsername(SlackUsername value) {
    if (value == null) throw new NullPointerException();
    setField_ = _Fields.SLACK_USERNAME;
    value_ = value;
  }

  public Email getEmail() {
    if (getSetField() == _Fields.EMAIL) {
      return (Email)getFieldValue();
    } else {
      throw new RuntimeException("Cannot get field 'email' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setEmail(Email value) {
    if (value == null) throw new NullPointerException();
    setField_ = _Fields.EMAIL;
    value_ = value;
  }

  public CustomChannel getCustomChannel() {
    if (getSetField() == _Fields.CUSTOM_CHANNEL) {
      return (CustomChannel)getFieldValue();
    } else {
      throw new RuntimeException("Cannot get field 'customChannel' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setCustomChannel(CustomChannel value) {
    if (value == null) throw new NullPointerException();
    setField_ = _Fields.CUSTOM_CHANNEL;
    value_ = value;
  }

  public IOSDevice getIosDevice() {
    if (getSetField() == _Fields.IOS_DEVICE) {
      return (IOSDevice)getFieldValue();
    } else {
      throw new RuntimeException("Cannot get field 'iosDevice' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setIosDevice(IOSDevice value) {
    if (value == null) throw new NullPointerException();
    setField_ = _Fields.IOS_DEVICE;
    value_ = value;
  }

  public AndroidDevice getAndroidDevice() {
    if (getSetField() == _Fields.ANDROID_DEVICE) {
      return (AndroidDevice)getFieldValue();
    } else {
      throw new RuntimeException("Cannot get field 'androidDevice' because union is currently set to " + getFieldDesc(getSetField()).name);
    }
  }

  public void setAndroidDevice(AndroidDevice value) {
    if (value == null) throw new NullPointerException();
    setField_ = _Fields.ANDROID_DEVICE;
    value_ = value;
  }

  public boolean isSetSlackChannel() {
    return setField_ == _Fields.SLACK_CHANNEL;
  }


  public boolean isSetSlackUsername() {
    return setField_ == _Fields.SLACK_USERNAME;
  }


  public boolean isSetEmail() {
    return setField_ == _Fields.EMAIL;
  }


  public boolean isSetCustomChannel() {
    return setField_ == _Fields.CUSTOM_CHANNEL;
  }


  public boolean isSetIosDevice() {
    return setField_ == _Fields.IOS_DEVICE;
  }


  public boolean isSetAndroidDevice() {
    return setField_ == _Fields.ANDROID_DEVICE;
  }


  public boolean equals(Object other) {
    if (other instanceof AromaChannel) {
      return equals((AromaChannel)other);
    } else {
      return false;
    }
  }

  public boolean equals(AromaChannel other) {
    return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
  }

  @Override
  public int compareTo(AromaChannel other) {
    int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
    if (lastComparison == 0) {
      return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
    }
    return lastComparison;
  }


  @Override
  public int hashCode() {
    List list = new ArrayList();
    list.add(this.getClass().getName());
    org.apache.thrift.TFieldIdEnum setField = getSetField();
    if (setField != null) {
      list.add(setField.getThriftFieldId());
      Object value = getFieldValue();
      if (value instanceof org.apache.thrift.TEnum) {
        list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue());
      } else {
        list.add(value);
      }
    }
    return list.hashCode();
  }
  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);
    }
  }


}