TTopicUpdate.java

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.doris.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class TTopicUpdate implements org.apache.thrift.TBase<TTopicUpdate, TTopicUpdate._Fields>, java.io.Serializable, Cloneable, Comparable<TTopicUpdate> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTopicUpdate");

  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField UPDATES_FIELD_DESC = new org.apache.thrift.protocol.TField("updates", org.apache.thrift.protocol.TType.LIST, (short)2);
  private static final org.apache.thrift.protocol.TField DELETES_FIELD_DESC = new org.apache.thrift.protocol.TField("deletes", org.apache.thrift.protocol.TType.LIST, (short)3);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TTopicUpdateStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TTopicUpdateTupleSchemeFactory();

  /**
   * 
   * @see TTopicType
   */
  public @org.apache.thrift.annotation.Nullable TTopicType type; // required
  public @org.apache.thrift.annotation.Nullable java.util.List<TTopicItem> updates; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> deletes; // 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 {
    /**
     * 
     * @see TTopicType
     */
    TYPE((short)1, "type"),
    UPDATES((short)2, "updates"),
    DELETES((short)3, "deletes");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // TYPE
          return TYPE;
        case 2: // UPDATES
          return UPDATES;
        case 3: // DELETES
          return DELETES;
        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 java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.UPDATES,_Fields.DELETES};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TTopicType.class)));
    tmpMap.put(_Fields.UPDATES, new org.apache.thrift.meta_data.FieldMetaData("updates", 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, TTopicItem.class))));
    tmpMap.put(_Fields.DELETES, new org.apache.thrift.meta_data.FieldMetaData("deletes", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TTopicUpdate.class, metaDataMap);
  }

  public TTopicUpdate() {
  }

  public TTopicUpdate(
    TTopicType type)
  {
    this();
    this.type = type;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TTopicUpdate(TTopicUpdate other) {
    if (other.isSetType()) {
      this.type = other.type;
    }
    if (other.isSetUpdates()) {
      java.util.List<TTopicItem> __this__updates = new java.util.ArrayList<TTopicItem>(other.updates.size());
      for (TTopicItem other_element : other.updates) {
        __this__updates.add(new TTopicItem(other_element));
      }
      this.updates = __this__updates;
    }
    if (other.isSetDeletes()) {
      java.util.List<java.lang.String> __this__deletes = new java.util.ArrayList<java.lang.String>(other.deletes);
      this.deletes = __this__deletes;
    }
  }

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

  @Override
  public void clear() {
    this.type = null;
    this.updates = null;
    this.deletes = null;
  }

  /**
   * 
   * @see TTopicType
   */
  @org.apache.thrift.annotation.Nullable
  public TTopicType getType() {
    return this.type;
  }

  /**
   * 
   * @see TTopicType
   */
  public TTopicUpdate setType(@org.apache.thrift.annotation.Nullable TTopicType type) {
    this.type = type;
    return this;
  }

  public void unsetType() {
    this.type = null;
  }

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

  public void setTypeIsSet(boolean value) {
    if (!value) {
      this.type = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<TTopicItem> getUpdatesIterator() {
    return (this.updates == null) ? null : this.updates.iterator();
  }

  public void addToUpdates(TTopicItem elem) {
    if (this.updates == null) {
      this.updates = new java.util.ArrayList<TTopicItem>();
    }
    this.updates.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<TTopicItem> getUpdates() {
    return this.updates;
  }

  public TTopicUpdate setUpdates(@org.apache.thrift.annotation.Nullable java.util.List<TTopicItem> updates) {
    this.updates = updates;
    return this;
  }

  public void unsetUpdates() {
    this.updates = null;
  }

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

  public void setUpdatesIsSet(boolean value) {
    if (!value) {
      this.updates = null;
    }
  }

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

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.String> getDeletesIterator() {
    return (this.deletes == null) ? null : this.deletes.iterator();
  }

  public void addToDeletes(java.lang.String elem) {
    if (this.deletes == null) {
      this.deletes = new java.util.ArrayList<java.lang.String>();
    }
    this.deletes.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.String> getDeletes() {
    return this.deletes;
  }

  public TTopicUpdate setDeletes(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> deletes) {
    this.deletes = deletes;
    return this;
  }

  public void unsetDeletes() {
    this.deletes = null;
  }

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

  public void setDeletesIsSet(boolean value) {
    if (!value) {
      this.deletes = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((TTopicType)value);
      }
      break;

    case UPDATES:
      if (value == null) {
        unsetUpdates();
      } else {
        setUpdates((java.util.List<TTopicItem>)value);
      }
      break;

    case DELETES:
      if (value == null) {
        unsetDeletes();
      } else {
        setDeletes((java.util.List<java.lang.String>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case TYPE:
      return getType();

    case UPDATES:
      return getUpdates();

    case DELETES:
      return getDeletes();

    }
    throw new java.lang.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 java.lang.IllegalArgumentException();
    }

    switch (field) {
    case TYPE:
      return isSetType();
    case UPDATES:
      return isSetUpdates();
    case DELETES:
      return isSetDeletes();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TTopicUpdate)
      return this.equals((TTopicUpdate)that);
    return false;
  }

  public boolean equals(TTopicUpdate that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type))
        return false;
      if (!this.type.equals(that.type))
        return false;
    }

    boolean this_present_updates = true && this.isSetUpdates();
    boolean that_present_updates = true && that.isSetUpdates();
    if (this_present_updates || that_present_updates) {
      if (!(this_present_updates && that_present_updates))
        return false;
      if (!this.updates.equals(that.updates))
        return false;
    }

    boolean this_present_deletes = true && this.isSetDeletes();
    boolean that_present_deletes = true && that.isSetDeletes();
    if (this_present_deletes || that_present_deletes) {
      if (!(this_present_deletes && that_present_deletes))
        return false;
      if (!this.deletes.equals(that.deletes))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
    if (isSetType())
      hashCode = hashCode * 8191 + type.getValue();

    hashCode = hashCode * 8191 + ((isSetUpdates()) ? 131071 : 524287);
    if (isSetUpdates())
      hashCode = hashCode * 8191 + updates.hashCode();

    hashCode = hashCode * 8191 + ((isSetDeletes()) ? 131071 : 524287);
    if (isSetDeletes())
      hashCode = hashCode * 8191 + deletes.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetType(), other.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetUpdates(), other.isSetUpdates());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUpdates()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.updates, other.updates);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetDeletes(), other.isSetDeletes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDeletes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deletes, other.deletes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TTopicUpdate(");
    boolean first = true;

    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    if (isSetUpdates()) {
      if (!first) sb.append(", ");
      sb.append("updates:");
      if (this.updates == null) {
        sb.append("null");
      } else {
        sb.append(this.updates);
      }
      first = false;
    }
    if (isSetDeletes()) {
      if (!first) sb.append(", ");
      sb.append("deletes:");
      if (this.deletes == null) {
        sb.append("null");
      } else {
        sb.append(this.deletes);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (type == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
    }
    // 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, java.lang.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 TTopicUpdateStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TTopicUpdateStandardScheme getScheme() {
      return new TTopicUpdateStandardScheme();
    }
  }

  private static class TTopicUpdateStandardScheme extends org.apache.thrift.scheme.StandardScheme<TTopicUpdate> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TTopicUpdate 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: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = org.apache.doris.thrift.TTopicType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // UPDATES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list352 = iprot.readListBegin();
                struct.updates = new java.util.ArrayList<TTopicItem>(_list352.size);
                @org.apache.thrift.annotation.Nullable TTopicItem _elem353;
                for (int _i354 = 0; _i354 < _list352.size; ++_i354)
                {
                  _elem353 = new TTopicItem();
                  _elem353.read(iprot);
                  struct.updates.add(_elem353);
                }
                iprot.readListEnd();
              }
              struct.setUpdatesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // DELETES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list355 = iprot.readListBegin();
                struct.deletes = new java.util.ArrayList<java.lang.String>(_list355.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _elem356;
                for (int _i357 = 0; _i357 < _list355.size; ++_i357)
                {
                  _elem356 = iprot.readString();
                  struct.deletes.add(_elem356);
                }
                iprot.readListEnd();
              }
              struct.setDeletesIsSet(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, TTopicUpdate struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.updates != null) {
        if (struct.isSetUpdates()) {
          oprot.writeFieldBegin(UPDATES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.updates.size()));
            for (TTopicItem _iter358 : struct.updates)
            {
              _iter358.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.deletes != null) {
        if (struct.isSetDeletes()) {
          oprot.writeFieldBegin(DELETES_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.deletes.size()));
            for (java.lang.String _iter359 : struct.deletes)
            {
              oprot.writeString(_iter359);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TTopicUpdateTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TTopicUpdateTupleScheme getScheme() {
      return new TTopicUpdateTupleScheme();
    }
  }

  private static class TTopicUpdateTupleScheme extends org.apache.thrift.scheme.TupleScheme<TTopicUpdate> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TTopicUpdate struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.type.getValue());
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetUpdates()) {
        optionals.set(0);
      }
      if (struct.isSetDeletes()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetUpdates()) {
        {
          oprot.writeI32(struct.updates.size());
          for (TTopicItem _iter360 : struct.updates)
          {
            _iter360.write(oprot);
          }
        }
      }
      if (struct.isSetDeletes()) {
        {
          oprot.writeI32(struct.deletes.size());
          for (java.lang.String _iter361 : struct.deletes)
          {
            oprot.writeString(_iter361);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TTopicUpdate struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.type = org.apache.doris.thrift.TTopicType.findByValue(iprot.readI32());
      struct.setTypeIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list362 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
          struct.updates = new java.util.ArrayList<TTopicItem>(_list362.size);
          @org.apache.thrift.annotation.Nullable TTopicItem _elem363;
          for (int _i364 = 0; _i364 < _list362.size; ++_i364)
          {
            _elem363 = new TTopicItem();
            _elem363.read(iprot);
            struct.updates.add(_elem363);
          }
        }
        struct.setUpdatesIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list365 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
          struct.deletes = new java.util.ArrayList<java.lang.String>(_list365.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _elem366;
          for (int _i367 = 0; _i367 < _list365.size; ++_i367)
          {
            _elem366 = iprot.readString();
            struct.deletes.add(_elem366);
          }
        }
        struct.setDeletesIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}