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

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

There is a newer version: 3.12.5
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 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 DomainReplicationConfiguration 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("DomainReplicationConfiguration");

  private static final org.apache.thrift.protocol.TField ACTIVE_CLUSTER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("activeClusterName", org.apache.thrift.protocol.TType.STRING, (short)10);
  private static final org.apache.thrift.protocol.TField CLUSTERS_FIELD_DESC = new org.apache.thrift.protocol.TField("clusters", org.apache.thrift.protocol.TType.LIST, (short)20);

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

  public String activeClusterName; // optional
  public List clusters; // 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 {
    ACTIVE_CLUSTER_NAME((short)10, "activeClusterName"),
    CLUSTERS((short)20, "clusters");

    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: // ACTIVE_CLUSTER_NAME
          return ACTIVE_CLUSTER_NAME;
        case 20: // CLUSTERS
          return CLUSTERS;
        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 _Fields optionals[] = {_Fields.ACTIVE_CLUSTER_NAME,_Fields.CLUSTERS};
  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.ACTIVE_CLUSTER_NAME, new org.apache.thrift.meta_data.FieldMetaData("activeClusterName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CLUSTERS, new org.apache.thrift.meta_data.FieldMetaData("clusters", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ClusterReplicationConfiguration.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DomainReplicationConfiguration.class, metaDataMap);
  }

  public DomainReplicationConfiguration() {
  }

  /**
   * Performs a deep copy on other.
   */
  public DomainReplicationConfiguration(DomainReplicationConfiguration other) {
    if (other.isSetActiveClusterName()) {
      this.activeClusterName = other.activeClusterName;
    }
    if (other.isSetClusters()) {
      List __this__clusters = new ArrayList(other.clusters.size());
      for (ClusterReplicationConfiguration other_element : other.clusters) {
        __this__clusters.add(new ClusterReplicationConfiguration(other_element));
      }
      this.clusters = __this__clusters;
    }
  }

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

  @Override
  public void clear() {
    this.activeClusterName = null;
    this.clusters = null;
  }

  public String getActiveClusterName() {
    return this.activeClusterName;
  }

  public DomainReplicationConfiguration setActiveClusterName(String activeClusterName) {
    this.activeClusterName = activeClusterName;
    return this;
  }

  public void unsetActiveClusterName() {
    this.activeClusterName = null;
  }

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

  public void setActiveClusterNameIsSet(boolean value) {
    if (!value) {
      this.activeClusterName = null;
    }
  }

  public int getClustersSize() {
    return (this.clusters == null) ? 0 : this.clusters.size();
  }

  public java.util.Iterator getClustersIterator() {
    return (this.clusters == null) ? null : this.clusters.iterator();
  }

  public void addToClusters(ClusterReplicationConfiguration elem) {
    if (this.clusters == null) {
      this.clusters = new ArrayList();
    }
    this.clusters.add(elem);
  }

  public List getClusters() {
    return this.clusters;
  }

  public DomainReplicationConfiguration setClusters(List clusters) {
    this.clusters = clusters;
    return this;
  }

  public void unsetClusters() {
    this.clusters = null;
  }

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

  public void setClustersIsSet(boolean value) {
    if (!value) {
      this.clusters = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ACTIVE_CLUSTER_NAME:
      if (value == null) {
        unsetActiveClusterName();
      } else {
        setActiveClusterName((String)value);
      }
      break;

    case CLUSTERS:
      if (value == null) {
        unsetClusters();
      } else {
        setClusters((List)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ACTIVE_CLUSTER_NAME:
      return getActiveClusterName();

    case CLUSTERS:
      return getClusters();

    }
    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 ACTIVE_CLUSTER_NAME:
      return isSetActiveClusterName();
    case CLUSTERS:
      return isSetClusters();
    }
    throw new IllegalStateException();
  }

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

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

    boolean this_present_activeClusterName = true && this.isSetActiveClusterName();
    boolean that_present_activeClusterName = true && that.isSetActiveClusterName();
    if (this_present_activeClusterName || that_present_activeClusterName) {
      if (!(this_present_activeClusterName && that_present_activeClusterName))
        return false;
      if (!this.activeClusterName.equals(that.activeClusterName))
        return false;
    }

    boolean this_present_clusters = true && this.isSetClusters();
    boolean that_present_clusters = true && that.isSetClusters();
    if (this_present_clusters || that_present_clusters) {
      if (!(this_present_clusters && that_present_clusters))
        return false;
      if (!this.clusters.equals(that.clusters))
        return false;
    }

    return true;
  }

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

    boolean present_activeClusterName = true && (isSetActiveClusterName());
    list.add(present_activeClusterName);
    if (present_activeClusterName)
      list.add(activeClusterName);

    boolean present_clusters = true && (isSetClusters());
    list.add(present_clusters);
    if (present_clusters)
      list.add(clusters);

    return list.hashCode();
  }

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

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetActiveClusterName()).compareTo(other.isSetActiveClusterName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetActiveClusterName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.activeClusterName, other.activeClusterName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetClusters()).compareTo(other.isSetClusters());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetClusters()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.clusters, other.clusters);
      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("DomainReplicationConfiguration(");
    boolean first = true;

    if (isSetActiveClusterName()) {
      sb.append("activeClusterName:");
      if (this.activeClusterName == null) {
        sb.append("null");
      } else {
        sb.append(this.activeClusterName);
      }
      first = false;
    }
    if (isSetClusters()) {
      if (!first) sb.append(", ");
      sb.append("clusters:");
      if (this.clusters == null) {
        sb.append("null");
      } else {
        sb.append(this.clusters);
      }
      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 DomainReplicationConfigurationStandardSchemeFactory implements SchemeFactory {
    public DomainReplicationConfigurationStandardScheme getScheme() {
      return new DomainReplicationConfigurationStandardScheme();
    }
  }

  private static class DomainReplicationConfigurationStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, DomainReplicationConfiguration 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: // ACTIVE_CLUSTER_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.activeClusterName = iprot.readString();
              struct.setActiveClusterNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // CLUSTERS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list48 = iprot.readListBegin();
                struct.clusters = new ArrayList(_list48.size);
                ClusterReplicationConfiguration _elem49;
                for (int _i50 = 0; _i50 < _list48.size; ++_i50)
                {
                  _elem49 = new ClusterReplicationConfiguration();
                  _elem49.read(iprot);
                  struct.clusters.add(_elem49);
                }
                iprot.readListEnd();
              }
              struct.setClustersIsSet(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, DomainReplicationConfiguration struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.activeClusterName != null) {
        if (struct.isSetActiveClusterName()) {
          oprot.writeFieldBegin(ACTIVE_CLUSTER_NAME_FIELD_DESC);
          oprot.writeString(struct.activeClusterName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.clusters != null) {
        if (struct.isSetClusters()) {
          oprot.writeFieldBegin(CLUSTERS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.clusters.size()));
            for (ClusterReplicationConfiguration _iter51 : struct.clusters)
            {
              _iter51.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class DomainReplicationConfigurationTupleSchemeFactory implements SchemeFactory {
    public DomainReplicationConfigurationTupleScheme getScheme() {
      return new DomainReplicationConfigurationTupleScheme();
    }
  }

  private static class DomainReplicationConfigurationTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, DomainReplicationConfiguration struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      BitSet optionals = new BitSet();
      if (struct.isSetActiveClusterName()) {
        optionals.set(0);
      }
      if (struct.isSetClusters()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetActiveClusterName()) {
        oprot.writeString(struct.activeClusterName);
      }
      if (struct.isSetClusters()) {
        {
          oprot.writeI32(struct.clusters.size());
          for (ClusterReplicationConfiguration _iter52 : struct.clusters)
          {
            _iter52.write(oprot);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, DomainReplicationConfiguration struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.activeClusterName = iprot.readString();
        struct.setActiveClusterNameIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.clusters = new ArrayList(_list53.size);
          ClusterReplicationConfiguration _elem54;
          for (int _i55 = 0; _i55 < _list53.size; ++_i55)
          {
            _elem54 = new ClusterReplicationConfiguration();
            _elem54.read(iprot);
            struct.clusters.add(_elem54);
          }
        }
        struct.setClustersIsSet(true);
      }
    }
  }

}