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

  private static final org.apache.thrift.protocol.TField CLUSTER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("cluster_name", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField CURRENT_CONNECTED_FE_HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("current_connected_fe_host", org.apache.thrift.protocol.TType.STRING, (short)2);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String cluster_name; // optional
  public @org.apache.thrift.annotation.Nullable java.lang.String current_connected_fe_host; // 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 {
    CLUSTER_NAME((short)1, "cluster_name"),
    CURRENT_CONNECTED_FE_HOST((short)2, "current_connected_fe_host");

    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: // CLUSTER_NAME
          return CLUSTER_NAME;
        case 2: // CURRENT_CONNECTED_FE_HOST
          return CURRENT_CONNECTED_FE_HOST;
        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.CLUSTER_NAME,_Fields.CURRENT_CONNECTED_FE_HOST};
  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.CLUSTER_NAME, new org.apache.thrift.meta_data.FieldMetaData("cluster_name", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CURRENT_CONNECTED_FE_HOST, new org.apache.thrift.meta_data.FieldMetaData("current_connected_fe_host", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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(TFrontendsMetadataParams.class, metaDataMap);
  }

  public TFrontendsMetadataParams() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TFrontendsMetadataParams(TFrontendsMetadataParams other) {
    if (other.isSetClusterName()) {
      this.cluster_name = other.cluster_name;
    }
    if (other.isSetCurrentConnectedFeHost()) {
      this.current_connected_fe_host = other.current_connected_fe_host;
    }
  }

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

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

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getClusterName() {
    return this.cluster_name;
  }

  public TFrontendsMetadataParams setClusterName(@org.apache.thrift.annotation.Nullable java.lang.String cluster_name) {
    this.cluster_name = cluster_name;
    return this;
  }

  public void unsetClusterName() {
    this.cluster_name = null;
  }

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

  public void setClusterNameIsSet(boolean value) {
    if (!value) {
      this.cluster_name = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getCurrentConnectedFeHost() {
    return this.current_connected_fe_host;
  }

  public TFrontendsMetadataParams setCurrentConnectedFeHost(@org.apache.thrift.annotation.Nullable java.lang.String current_connected_fe_host) {
    this.current_connected_fe_host = current_connected_fe_host;
    return this;
  }

  public void unsetCurrentConnectedFeHost() {
    this.current_connected_fe_host = null;
  }

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

  public void setCurrentConnectedFeHostIsSet(boolean value) {
    if (!value) {
      this.current_connected_fe_host = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case CLUSTER_NAME:
      if (value == null) {
        unsetClusterName();
      } else {
        setClusterName((java.lang.String)value);
      }
      break;

    case CURRENT_CONNECTED_FE_HOST:
      if (value == null) {
        unsetCurrentConnectedFeHost();
      } else {
        setCurrentConnectedFeHost((java.lang.String)value);
      }
      break;

    }
  }

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

    case CURRENT_CONNECTED_FE_HOST:
      return getCurrentConnectedFeHost();

    }
    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 CLUSTER_NAME:
      return isSetClusterName();
    case CURRENT_CONNECTED_FE_HOST:
      return isSetCurrentConnectedFeHost();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_cluster_name = true && this.isSetClusterName();
    boolean that_present_cluster_name = true && that.isSetClusterName();
    if (this_present_cluster_name || that_present_cluster_name) {
      if (!(this_present_cluster_name && that_present_cluster_name))
        return false;
      if (!this.cluster_name.equals(that.cluster_name))
        return false;
    }

    boolean this_present_current_connected_fe_host = true && this.isSetCurrentConnectedFeHost();
    boolean that_present_current_connected_fe_host = true && that.isSetCurrentConnectedFeHost();
    if (this_present_current_connected_fe_host || that_present_current_connected_fe_host) {
      if (!(this_present_current_connected_fe_host && that_present_current_connected_fe_host))
        return false;
      if (!this.current_connected_fe_host.equals(that.current_connected_fe_host))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetClusterName()) ? 131071 : 524287);
    if (isSetClusterName())
      hashCode = hashCode * 8191 + cluster_name.hashCode();

    hashCode = hashCode * 8191 + ((isSetCurrentConnectedFeHost()) ? 131071 : 524287);
    if (isSetCurrentConnectedFeHost())
      hashCode = hashCode * 8191 + current_connected_fe_host.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

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

    if (isSetClusterName()) {
      sb.append("cluster_name:");
      if (this.cluster_name == null) {
        sb.append("null");
      } else {
        sb.append(this.cluster_name);
      }
      first = false;
    }
    if (isSetCurrentConnectedFeHost()) {
      if (!first) sb.append(", ");
      sb.append("current_connected_fe_host:");
      if (this.current_connected_fe_host == null) {
        sb.append("null");
      } else {
        sb.append(this.current_connected_fe_host);
      }
      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, 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 TFrontendsMetadataParamsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TFrontendsMetadataParamsStandardScheme getScheme() {
      return new TFrontendsMetadataParamsStandardScheme();
    }
  }

  private static class TFrontendsMetadataParamsStandardScheme extends org.apache.thrift.scheme.StandardScheme<TFrontendsMetadataParams> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TFrontendsMetadataParams 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: // CLUSTER_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.cluster_name = iprot.readString();
              struct.setClusterNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // CURRENT_CONNECTED_FE_HOST
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.current_connected_fe_host = iprot.readString();
              struct.setCurrentConnectedFeHostIsSet(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, TFrontendsMetadataParams struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.cluster_name != null) {
        if (struct.isSetClusterName()) {
          oprot.writeFieldBegin(CLUSTER_NAME_FIELD_DESC);
          oprot.writeString(struct.cluster_name);
          oprot.writeFieldEnd();
        }
      }
      if (struct.current_connected_fe_host != null) {
        if (struct.isSetCurrentConnectedFeHost()) {
          oprot.writeFieldBegin(CURRENT_CONNECTED_FE_HOST_FIELD_DESC);
          oprot.writeString(struct.current_connected_fe_host);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TFrontendsMetadataParamsTupleScheme extends org.apache.thrift.scheme.TupleScheme<TFrontendsMetadataParams> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TFrontendsMetadataParams struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetClusterName()) {
        optionals.set(0);
      }
      if (struct.isSetCurrentConnectedFeHost()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetClusterName()) {
        oprot.writeString(struct.cluster_name);
      }
      if (struct.isSetCurrentConnectedFeHost()) {
        oprot.writeString(struct.current_connected_fe_host);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TFrontendsMetadataParams struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.cluster_name = iprot.readString();
        struct.setClusterNameIsSet(true);
      }
      if (incoming.get(1)) {
        struct.current_connected_fe_host = iprot.readString();
        struct.setCurrentConnectedFeHostIsSet(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();
  }
}