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

com.uber.cadence.DescribeTaskListRequest Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.9.3)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.uber.cadence;

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 = "2019-06-18")
public class DescribeTaskListRequest 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("DescribeTaskListRequest");

  private static final org.apache.thrift.protocol.TField DOMAIN_FIELD_DESC = new org.apache.thrift.protocol.TField("domain", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField TASK_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("taskList", org.apache.thrift.protocol.TType.STRUCT, (short)20);
  private static final org.apache.thrift.protocol.TField TASK_LIST_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("taskListType", org.apache.thrift.protocol.TType.I32, (short)30);
  private static final org.apache.thrift.protocol.TField INCLUDE_TASK_LIST_STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("includeTaskListStatus", org.apache.thrift.protocol.TType.BOOL, (short)40);

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

  public String domain; // optional
  public TaskList taskList; // optional
  public TaskListType taskListType; // optional
  public boolean includeTaskListStatus; // 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 {
    DOMAIN((short)10, "domain"),
    TASK_LIST((short)20, "taskList"),
    TASK_LIST_TYPE((short)30, "taskListType"),
    INCLUDE_TASK_LIST_STATUS((short)40, "includeTaskListStatus");

    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 10: // DOMAIN
          return DOMAIN;
        case 20: // TASK_LIST
          return TASK_LIST;
        case 30: // TASK_LIST_TYPE
          return TASK_LIST_TYPE;
        case 40: // INCLUDE_TASK_LIST_STATUS
          return INCLUDE_TASK_LIST_STATUS;
        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 __INCLUDETASKLISTSTATUS_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.DOMAIN,_Fields.TASK_LIST,_Fields.TASK_LIST_TYPE,_Fields.INCLUDE_TASK_LIST_STATUS};
  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.DOMAIN, new org.apache.thrift.meta_data.FieldMetaData("domain", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.TASK_LIST, new org.apache.thrift.meta_data.FieldMetaData("taskList", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TaskList.class)));
    tmpMap.put(_Fields.TASK_LIST_TYPE, new org.apache.thrift.meta_data.FieldMetaData("taskListType", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.ENUM        , "TaskListType")));
    tmpMap.put(_Fields.INCLUDE_TASK_LIST_STATUS, new org.apache.thrift.meta_data.FieldMetaData("includeTaskListStatus", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DescribeTaskListRequest.class, metaDataMap);
  }

  public DescribeTaskListRequest() {
  }

  /**
   * Performs a deep copy on other.
   */
  public DescribeTaskListRequest(DescribeTaskListRequest other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetDomain()) {
      this.domain = other.domain;
    }
    if (other.isSetTaskList()) {
      this.taskList = new TaskList(other.taskList);
    }
    if (other.isSetTaskListType()) {
      this.taskListType = other.taskListType;
    }
    this.includeTaskListStatus = other.includeTaskListStatus;
  }

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

  @Override
  public void clear() {
    this.domain = null;
    this.taskList = null;
    this.taskListType = null;
    setIncludeTaskListStatusIsSet(false);
    this.includeTaskListStatus = false;
  }

  public String getDomain() {
    return this.domain;
  }

  public DescribeTaskListRequest setDomain(String domain) {
    this.domain = domain;
    return this;
  }

  public void unsetDomain() {
    this.domain = null;
  }

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

  public void setDomainIsSet(boolean value) {
    if (!value) {
      this.domain = null;
    }
  }

  public TaskList getTaskList() {
    return this.taskList;
  }

  public DescribeTaskListRequest setTaskList(TaskList taskList) {
    this.taskList = taskList;
    return this;
  }

  public void unsetTaskList() {
    this.taskList = null;
  }

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

  public void setTaskListIsSet(boolean value) {
    if (!value) {
      this.taskList = null;
    }
  }

  public TaskListType getTaskListType() {
    return this.taskListType;
  }

  public DescribeTaskListRequest setTaskListType(TaskListType taskListType) {
    this.taskListType = taskListType;
    return this;
  }

  public void unsetTaskListType() {
    this.taskListType = null;
  }

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

  public void setTaskListTypeIsSet(boolean value) {
    if (!value) {
      this.taskListType = null;
    }
  }

  public boolean isIncludeTaskListStatus() {
    return this.includeTaskListStatus;
  }

  public DescribeTaskListRequest setIncludeTaskListStatus(boolean includeTaskListStatus) {
    this.includeTaskListStatus = includeTaskListStatus;
    setIncludeTaskListStatusIsSet(true);
    return this;
  }

  public void unsetIncludeTaskListStatus() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __INCLUDETASKLISTSTATUS_ISSET_ID);
  }

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

  public void setIncludeTaskListStatusIsSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __INCLUDETASKLISTSTATUS_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case DOMAIN:
      if (value == null) {
        unsetDomain();
      } else {
        setDomain((String)value);
      }
      break;

    case TASK_LIST:
      if (value == null) {
        unsetTaskList();
      } else {
        setTaskList((TaskList)value);
      }
      break;

    case TASK_LIST_TYPE:
      if (value == null) {
        unsetTaskListType();
      } else {
        setTaskListType((TaskListType)value);
      }
      break;

    case INCLUDE_TASK_LIST_STATUS:
      if (value == null) {
        unsetIncludeTaskListStatus();
      } else {
        setIncludeTaskListStatus((Boolean)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case DOMAIN:
      return getDomain();

    case TASK_LIST:
      return getTaskList();

    case TASK_LIST_TYPE:
      return getTaskListType();

    case INCLUDE_TASK_LIST_STATUS:
      return isIncludeTaskListStatus();

    }
    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 DOMAIN:
      return isSetDomain();
    case TASK_LIST:
      return isSetTaskList();
    case TASK_LIST_TYPE:
      return isSetTaskListType();
    case INCLUDE_TASK_LIST_STATUS:
      return isSetIncludeTaskListStatus();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_domain = true && this.isSetDomain();
    boolean that_present_domain = true && that.isSetDomain();
    if (this_present_domain || that_present_domain) {
      if (!(this_present_domain && that_present_domain))
        return false;
      if (!this.domain.equals(that.domain))
        return false;
    }

    boolean this_present_taskList = true && this.isSetTaskList();
    boolean that_present_taskList = true && that.isSetTaskList();
    if (this_present_taskList || that_present_taskList) {
      if (!(this_present_taskList && that_present_taskList))
        return false;
      if (!this.taskList.equals(that.taskList))
        return false;
    }

    boolean this_present_taskListType = true && this.isSetTaskListType();
    boolean that_present_taskListType = true && that.isSetTaskListType();
    if (this_present_taskListType || that_present_taskListType) {
      if (!(this_present_taskListType && that_present_taskListType))
        return false;
      if (!this.taskListType.equals(that.taskListType))
        return false;
    }

    boolean this_present_includeTaskListStatus = true && this.isSetIncludeTaskListStatus();
    boolean that_present_includeTaskListStatus = true && that.isSetIncludeTaskListStatus();
    if (this_present_includeTaskListStatus || that_present_includeTaskListStatus) {
      if (!(this_present_includeTaskListStatus && that_present_includeTaskListStatus))
        return false;
      if (this.includeTaskListStatus != that.includeTaskListStatus)
        return false;
    }

    return true;
  }

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

    boolean present_domain = true && (isSetDomain());
    list.add(present_domain);
    if (present_domain)
      list.add(domain);

    boolean present_taskList = true && (isSetTaskList());
    list.add(present_taskList);
    if (present_taskList)
      list.add(taskList);

    boolean present_taskListType = true && (isSetTaskListType());
    list.add(present_taskListType);
    if (present_taskListType)
      list.add(taskListType.getValue());

    boolean present_includeTaskListStatus = true && (isSetIncludeTaskListStatus());
    list.add(present_includeTaskListStatus);
    if (present_includeTaskListStatus)
      list.add(includeTaskListStatus);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetDomain()).compareTo(other.isSetDomain());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDomain()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.domain, other.domain);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTaskList()).compareTo(other.isSetTaskList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTaskList()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskList, other.taskList);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTaskListType()).compareTo(other.isSetTaskListType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTaskListType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.taskListType, other.taskListType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIncludeTaskListStatus()).compareTo(other.isSetIncludeTaskListStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIncludeTaskListStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.includeTaskListStatus, other.includeTaskListStatus);
      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("DescribeTaskListRequest(");
    boolean first = true;

    if (isSetDomain()) {
      sb.append("domain:");
      if (this.domain == null) {
        sb.append("null");
      } else {
        sb.append(this.domain);
      }
      first = false;
    }
    if (isSetTaskList()) {
      if (!first) sb.append(", ");
      sb.append("taskList:");
      if (this.taskList == null) {
        sb.append("null");
      } else {
        sb.append(this.taskList);
      }
      first = false;
    }
    if (isSetTaskListType()) {
      if (!first) sb.append(", ");
      sb.append("taskListType:");
      if (this.taskListType == null) {
        sb.append("null");
      } else {
        sb.append(this.taskListType);
      }
      first = false;
    }
    if (isSetIncludeTaskListStatus()) {
      if (!first) sb.append(", ");
      sb.append("includeTaskListStatus:");
      sb.append(this.includeTaskListStatus);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (taskList != null) {
      taskList.validate();
    }
  }

  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 DescribeTaskListRequestStandardSchemeFactory implements SchemeFactory {
    public DescribeTaskListRequestStandardScheme getScheme() {
      return new DescribeTaskListRequestStandardScheme();
    }
  }

  private static class DescribeTaskListRequestStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, DescribeTaskListRequest 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 10: // DOMAIN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.domain = iprot.readString();
              struct.setDomainIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // TASK_LIST
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.taskList = new TaskList();
              struct.taskList.read(iprot);
              struct.setTaskListIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 30: // TASK_LIST_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.taskListType = com.uber.cadence.TaskListType.findByValue(iprot.readI32());
              struct.setTaskListTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 40: // INCLUDE_TASK_LIST_STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.includeTaskListStatus = iprot.readBool();
              struct.setIncludeTaskListStatusIsSet(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, DescribeTaskListRequest struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.domain != null) {
        if (struct.isSetDomain()) {
          oprot.writeFieldBegin(DOMAIN_FIELD_DESC);
          oprot.writeString(struct.domain);
          oprot.writeFieldEnd();
        }
      }
      if (struct.taskList != null) {
        if (struct.isSetTaskList()) {
          oprot.writeFieldBegin(TASK_LIST_FIELD_DESC);
          struct.taskList.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.taskListType != null) {
        if (struct.isSetTaskListType()) {
          oprot.writeFieldBegin(TASK_LIST_TYPE_FIELD_DESC);
          oprot.writeI32(struct.taskListType.getValue());
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetIncludeTaskListStatus()) {
        oprot.writeFieldBegin(INCLUDE_TASK_LIST_STATUS_FIELD_DESC);
        oprot.writeBool(struct.includeTaskListStatus);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class DescribeTaskListRequestTupleSchemeFactory implements SchemeFactory {
    public DescribeTaskListRequestTupleScheme getScheme() {
      return new DescribeTaskListRequestTupleScheme();
    }
  }

  private static class DescribeTaskListRequestTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, DescribeTaskListRequest struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetDomain()) {
        optionals.set(0);
      }
      if (struct.isSetTaskList()) {
        optionals.set(1);
      }
      if (struct.isSetTaskListType()) {
        optionals.set(2);
      }
      if (struct.isSetIncludeTaskListStatus()) {
        optionals.set(3);
      }
      oprot.writeBitSet(optionals, 4);
      if (struct.isSetDomain()) {
        oprot.writeString(struct.domain);
      }
      if (struct.isSetTaskList()) {
        struct.taskList.write(oprot);
      }
      if (struct.isSetTaskListType()) {
        oprot.writeI32(struct.taskListType.getValue());
      }
      if (struct.isSetIncludeTaskListStatus()) {
        oprot.writeBool(struct.includeTaskListStatus);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, DescribeTaskListRequest struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(4);
      if (incoming.get(0)) {
        struct.domain = iprot.readString();
        struct.setDomainIsSet(true);
      }
      if (incoming.get(1)) {
        struct.taskList = new TaskList();
        struct.taskList.read(iprot);
        struct.setTaskListIsSet(true);
      }
      if (incoming.get(2)) {
        struct.taskListType = com.uber.cadence.TaskListType.findByValue(iprot.readI32());
        struct.setTaskListTypeIsSet(true);
      }
      if (incoming.get(3)) {
        struct.includeTaskListStatus = iprot.readBool();
        struct.setIncludeTaskListStatusIsSet(true);
      }
    }
  }

}