TPublishTopicRequest.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 TPublishTopicRequest implements org.apache.thrift.TBase<TPublishTopicRequest, TPublishTopicRequest._Fields>, java.io.Serializable, Cloneable, Comparable<TPublishTopicRequest> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPublishTopicRequest");

  private static final org.apache.thrift.protocol.TField TOPIC_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("topic_map", org.apache.thrift.protocol.TType.MAP, (short)1);

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

  public @org.apache.thrift.annotation.Nullable java.util.Map<TTopicInfoType,java.util.List<TopicInfo>> topic_map; // 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 {
    TOPIC_MAP((short)1, "topic_map");

    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: // TOPIC_MAP
          return TOPIC_MAP;
        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
  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.TOPIC_MAP, new org.apache.thrift.meta_data.FieldMetaData("topic_map", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TTopicInfoType.class), 
            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, TopicInfo.class)))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPublishTopicRequest.class, metaDataMap);
  }

  public TPublishTopicRequest() {
  }

  public TPublishTopicRequest(
    java.util.Map<TTopicInfoType,java.util.List<TopicInfo>> topic_map)
  {
    this();
    this.topic_map = topic_map;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TPublishTopicRequest(TPublishTopicRequest other) {
    if (other.isSetTopicMap()) {
      java.util.Map<TTopicInfoType,java.util.List<TopicInfo>> __this__topic_map = new java.util.EnumMap<TTopicInfoType,java.util.List<TopicInfo>>(TTopicInfoType.class);
      for (java.util.Map.Entry<TTopicInfoType, java.util.List<TopicInfo>> other_element : other.topic_map.entrySet()) {

        TTopicInfoType other_element_key = other_element.getKey();
        java.util.List<TopicInfo> other_element_value = other_element.getValue();

        TTopicInfoType __this__topic_map_copy_key = other_element_key;

        java.util.List<TopicInfo> __this__topic_map_copy_value = new java.util.ArrayList<TopicInfo>(other_element_value.size());
        for (TopicInfo other_element_value_element : other_element_value) {
          __this__topic_map_copy_value.add(new TopicInfo(other_element_value_element));
        }

        __this__topic_map.put(__this__topic_map_copy_key, __this__topic_map_copy_value);
      }
      this.topic_map = __this__topic_map;
    }
  }

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

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

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

  public void putToTopicMap(TTopicInfoType key, java.util.List<TopicInfo> val) {
    if (this.topic_map == null) {
      this.topic_map = new java.util.EnumMap<TTopicInfoType,java.util.List<TopicInfo>>(TTopicInfoType.class);
    }
    this.topic_map.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<TTopicInfoType,java.util.List<TopicInfo>> getTopicMap() {
    return this.topic_map;
  }

  public TPublishTopicRequest setTopicMap(@org.apache.thrift.annotation.Nullable java.util.Map<TTopicInfoType,java.util.List<TopicInfo>> topic_map) {
    this.topic_map = topic_map;
    return this;
  }

  public void unsetTopicMap() {
    this.topic_map = null;
  }

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

  public void setTopicMapIsSet(boolean value) {
    if (!value) {
      this.topic_map = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TOPIC_MAP:
      if (value == null) {
        unsetTopicMap();
      } else {
        setTopicMap((java.util.Map<TTopicInfoType,java.util.List<TopicInfo>>)value);
      }
      break;

    }
  }

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

    }
    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 TOPIC_MAP:
      return isSetTopicMap();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_topic_map = true && this.isSetTopicMap();
    boolean that_present_topic_map = true && that.isSetTopicMap();
    if (this_present_topic_map || that_present_topic_map) {
      if (!(this_present_topic_map && that_present_topic_map))
        return false;
      if (!this.topic_map.equals(that.topic_map))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetTopicMap()) ? 131071 : 524287);
    if (isSetTopicMap())
      hashCode = hashCode * 8191 + topic_map.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetTopicMap(), other.isSetTopicMap());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTopicMap()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.topic_map, other.topic_map);
      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("TPublishTopicRequest(");
    boolean first = true;

    sb.append("topic_map:");
    if (this.topic_map == null) {
      sb.append("null");
    } else {
      sb.append(this.topic_map);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (topic_map == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'topic_map' 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 TPublishTopicRequestStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TPublishTopicRequestStandardScheme getScheme() {
      return new TPublishTopicRequestStandardScheme();
    }
  }

  private static class TPublishTopicRequestStandardScheme extends org.apache.thrift.scheme.StandardScheme<TPublishTopicRequest> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TPublishTopicRequest 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: // TOPIC_MAP
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map162 = iprot.readMapBegin();
                struct.topic_map = new java.util.EnumMap<TTopicInfoType,java.util.List<TopicInfo>>(TTopicInfoType.class);
                @org.apache.thrift.annotation.Nullable TTopicInfoType _key163;
                @org.apache.thrift.annotation.Nullable java.util.List<TopicInfo> _val164;
                for (int _i165 = 0; _i165 < _map162.size; ++_i165)
                {
                  _key163 = org.apache.doris.thrift.TTopicInfoType.findByValue(iprot.readI32());
                  {
                    org.apache.thrift.protocol.TList _list166 = iprot.readListBegin();
                    _val164 = new java.util.ArrayList<TopicInfo>(_list166.size);
                    @org.apache.thrift.annotation.Nullable TopicInfo _elem167;
                    for (int _i168 = 0; _i168 < _list166.size; ++_i168)
                    {
                      _elem167 = new TopicInfo();
                      _elem167.read(iprot);
                      _val164.add(_elem167);
                    }
                    iprot.readListEnd();
                  }
                  if (_key163 != null)
                  {
                    struct.topic_map.put(_key163, _val164);
                  }
                }
                iprot.readMapEnd();
              }
              struct.setTopicMapIsSet(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, TPublishTopicRequest struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.topic_map != null) {
        oprot.writeFieldBegin(TOPIC_MAP_FIELD_DESC);
        {
          oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.LIST, struct.topic_map.size()));
          for (java.util.Map.Entry<TTopicInfoType, java.util.List<TopicInfo>> _iter169 : struct.topic_map.entrySet())
          {
            oprot.writeI32(_iter169.getKey().getValue());
            {
              oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, _iter169.getValue().size()));
              for (TopicInfo _iter170 : _iter169.getValue())
              {
                _iter170.write(oprot);
              }
              oprot.writeListEnd();
            }
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TPublishTopicRequestTupleScheme extends org.apache.thrift.scheme.TupleScheme<TPublishTopicRequest> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TPublishTopicRequest struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        oprot.writeI32(struct.topic_map.size());
        for (java.util.Map.Entry<TTopicInfoType, java.util.List<TopicInfo>> _iter171 : struct.topic_map.entrySet())
        {
          oprot.writeI32(_iter171.getKey().getValue());
          {
            oprot.writeI32(_iter171.getValue().size());
            for (TopicInfo _iter172 : _iter171.getValue())
            {
              _iter172.write(oprot);
            }
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TPublishTopicRequest struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      {
        org.apache.thrift.protocol.TMap _map173 = iprot.readMapBegin(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.LIST); 
        struct.topic_map = new java.util.EnumMap<TTopicInfoType,java.util.List<TopicInfo>>(TTopicInfoType.class);
        @org.apache.thrift.annotation.Nullable TTopicInfoType _key174;
        @org.apache.thrift.annotation.Nullable java.util.List<TopicInfo> _val175;
        for (int _i176 = 0; _i176 < _map173.size; ++_i176)
        {
          _key174 = org.apache.doris.thrift.TTopicInfoType.findByValue(iprot.readI32());
          {
            org.apache.thrift.protocol.TList _list177 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
            _val175 = new java.util.ArrayList<TopicInfo>(_list177.size);
            @org.apache.thrift.annotation.Nullable TopicInfo _elem178;
            for (int _i179 = 0; _i179 < _list177.size; ++_i179)
            {
              _elem178 = new TopicInfo();
              _elem178.read(iprot);
              _val175.add(_elem178);
            }
          }
          if (_key174 != null)
          {
            struct.topic_map.put(_key174, _val175);
          }
        }
      }
      struct.setTopicMapIsSet(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();
  }
}