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

org.apache.iotdb.service.rpc.thrift.TSOpenSessionReq Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift Compiler (0.14.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.iotdb.service.rpc.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)", date = "2023-04-20")
public class TSOpenSessionReq 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("TSOpenSessionReq");

  private static final org.apache.thrift.protocol.TField CLIENT_PROTOCOL_FIELD_DESC = new org.apache.thrift.protocol.TField("client_protocol", org.apache.thrift.protocol.TType.I32, (short)1);
  private static final org.apache.thrift.protocol.TField ZONE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("zoneId", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)4);
  private static final org.apache.thrift.protocol.TField CONFIGURATION_FIELD_DESC = new org.apache.thrift.protocol.TField("configuration", org.apache.thrift.protocol.TType.MAP, (short)5);

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

  /**
   * 
   * @see TSProtocolVersion
   */
  public @org.apache.thrift.annotation.Nullable TSProtocolVersion client_protocol; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String zoneId; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String username; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String password; // optional
  public @org.apache.thrift.annotation.Nullable java.util.Map configuration; // 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 TSProtocolVersion
     */
    CLIENT_PROTOCOL((short)1, "client_protocol"),
    ZONE_ID((short)2, "zoneId"),
    USERNAME((short)3, "username"),
    PASSWORD((short)4, "password"),
    CONFIGURATION((short)5, "configuration");

    private static final java.util.Map byName = new java.util.HashMap();

    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: // CLIENT_PROTOCOL
          return CLIENT_PROTOCOL;
        case 2: // ZONE_ID
          return ZONE_ID;
        case 3: // USERNAME
          return USERNAME;
        case 4: // PASSWORD
          return PASSWORD;
        case 5: // CONFIGURATION
          return CONFIGURATION;
        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.PASSWORD,_Fields.CONFIGURATION};
  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.CLIENT_PROTOCOL, new org.apache.thrift.meta_data.FieldMetaData("client_protocol", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TSProtocolVersion.class)));
    tmpMap.put(_Fields.ZONE_ID, new org.apache.thrift.meta_data.FieldMetaData("zoneId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.CONFIGURATION, new org.apache.thrift.meta_data.FieldMetaData("configuration", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            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(TSOpenSessionReq.class, metaDataMap);
  }

  public TSOpenSessionReq() {
    this.client_protocol = org.apache.iotdb.service.rpc.thrift.TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V3;

  }

  public TSOpenSessionReq(
    TSProtocolVersion client_protocol,
    java.lang.String zoneId,
    java.lang.String username)
  {
    this();
    this.client_protocol = client_protocol;
    this.zoneId = zoneId;
    this.username = username;
  }

  /**
   * Performs a deep copy on other.
   */
  public TSOpenSessionReq(TSOpenSessionReq other) {
    if (other.isSetClient_protocol()) {
      this.client_protocol = other.client_protocol;
    }
    if (other.isSetZoneId()) {
      this.zoneId = other.zoneId;
    }
    if (other.isSetUsername()) {
      this.username = other.username;
    }
    if (other.isSetPassword()) {
      this.password = other.password;
    }
    if (other.isSetConfiguration()) {
      java.util.Map __this__configuration = new java.util.HashMap(other.configuration);
      this.configuration = __this__configuration;
    }
  }

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

  @Override
  public void clear() {
    this.client_protocol = org.apache.iotdb.service.rpc.thrift.TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V3;

    this.zoneId = null;
    this.username = null;
    this.password = null;
    this.configuration = null;
  }

  /**
   * 
   * @see TSProtocolVersion
   */
  @org.apache.thrift.annotation.Nullable
  public TSProtocolVersion getClient_protocol() {
    return this.client_protocol;
  }

  /**
   * 
   * @see TSProtocolVersion
   */
  public TSOpenSessionReq setClient_protocol(@org.apache.thrift.annotation.Nullable TSProtocolVersion client_protocol) {
    this.client_protocol = client_protocol;
    return this;
  }

  public void unsetClient_protocol() {
    this.client_protocol = null;
  }

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

  public void setClient_protocolIsSet(boolean value) {
    if (!value) {
      this.client_protocol = null;
    }
  }

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

  public TSOpenSessionReq setZoneId(@org.apache.thrift.annotation.Nullable java.lang.String zoneId) {
    this.zoneId = zoneId;
    return this;
  }

  public void unsetZoneId() {
    this.zoneId = null;
  }

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

  public void setZoneIdIsSet(boolean value) {
    if (!value) {
      this.zoneId = null;
    }
  }

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

  public TSOpenSessionReq setUsername(@org.apache.thrift.annotation.Nullable java.lang.String username) {
    this.username = username;
    return this;
  }

  public void unsetUsername() {
    this.username = null;
  }

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

  public void setUsernameIsSet(boolean value) {
    if (!value) {
      this.username = null;
    }
  }

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

  public TSOpenSessionReq setPassword(@org.apache.thrift.annotation.Nullable java.lang.String password) {
    this.password = password;
    return this;
  }

  public void unsetPassword() {
    this.password = null;
  }

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

  public void setPasswordIsSet(boolean value) {
    if (!value) {
      this.password = null;
    }
  }

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

  public void putToConfiguration(java.lang.String key, java.lang.String val) {
    if (this.configuration == null) {
      this.configuration = new java.util.HashMap();
    }
    this.configuration.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map getConfiguration() {
    return this.configuration;
  }

  public TSOpenSessionReq setConfiguration(@org.apache.thrift.annotation.Nullable java.util.Map configuration) {
    this.configuration = configuration;
    return this;
  }

  public void unsetConfiguration() {
    this.configuration = null;
  }

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

  public void setConfigurationIsSet(boolean value) {
    if (!value) {
      this.configuration = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case CLIENT_PROTOCOL:
      if (value == null) {
        unsetClient_protocol();
      } else {
        setClient_protocol((TSProtocolVersion)value);
      }
      break;

    case ZONE_ID:
      if (value == null) {
        unsetZoneId();
      } else {
        setZoneId((java.lang.String)value);
      }
      break;

    case USERNAME:
      if (value == null) {
        unsetUsername();
      } else {
        setUsername((java.lang.String)value);
      }
      break;

    case PASSWORD:
      if (value == null) {
        unsetPassword();
      } else {
        setPassword((java.lang.String)value);
      }
      break;

    case CONFIGURATION:
      if (value == null) {
        unsetConfiguration();
      } else {
        setConfiguration((java.util.Map)value);
      }
      break;

    }
  }

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

    case ZONE_ID:
      return getZoneId();

    case USERNAME:
      return getUsername();

    case PASSWORD:
      return getPassword();

    case CONFIGURATION:
      return getConfiguration();

    }
    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 CLIENT_PROTOCOL:
      return isSetClient_protocol();
    case ZONE_ID:
      return isSetZoneId();
    case USERNAME:
      return isSetUsername();
    case PASSWORD:
      return isSetPassword();
    case CONFIGURATION:
      return isSetConfiguration();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_client_protocol = true && this.isSetClient_protocol();
    boolean that_present_client_protocol = true && that.isSetClient_protocol();
    if (this_present_client_protocol || that_present_client_protocol) {
      if (!(this_present_client_protocol && that_present_client_protocol))
        return false;
      if (!this.client_protocol.equals(that.client_protocol))
        return false;
    }

    boolean this_present_zoneId = true && this.isSetZoneId();
    boolean that_present_zoneId = true && that.isSetZoneId();
    if (this_present_zoneId || that_present_zoneId) {
      if (!(this_present_zoneId && that_present_zoneId))
        return false;
      if (!this.zoneId.equals(that.zoneId))
        return false;
    }

    boolean this_present_username = true && this.isSetUsername();
    boolean that_present_username = true && that.isSetUsername();
    if (this_present_username || that_present_username) {
      if (!(this_present_username && that_present_username))
        return false;
      if (!this.username.equals(that.username))
        return false;
    }

    boolean this_present_password = true && this.isSetPassword();
    boolean that_present_password = true && that.isSetPassword();
    if (this_present_password || that_present_password) {
      if (!(this_present_password && that_present_password))
        return false;
      if (!this.password.equals(that.password))
        return false;
    }

    boolean this_present_configuration = true && this.isSetConfiguration();
    boolean that_present_configuration = true && that.isSetConfiguration();
    if (this_present_configuration || that_present_configuration) {
      if (!(this_present_configuration && that_present_configuration))
        return false;
      if (!this.configuration.equals(that.configuration))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetClient_protocol()) ? 131071 : 524287);
    if (isSetClient_protocol())
      hashCode = hashCode * 8191 + client_protocol.getValue();

    hashCode = hashCode * 8191 + ((isSetZoneId()) ? 131071 : 524287);
    if (isSetZoneId())
      hashCode = hashCode * 8191 + zoneId.hashCode();

    hashCode = hashCode * 8191 + ((isSetUsername()) ? 131071 : 524287);
    if (isSetUsername())
      hashCode = hashCode * 8191 + username.hashCode();

    hashCode = hashCode * 8191 + ((isSetPassword()) ? 131071 : 524287);
    if (isSetPassword())
      hashCode = hashCode * 8191 + password.hashCode();

    hashCode = hashCode * 8191 + ((isSetConfiguration()) ? 131071 : 524287);
    if (isSetConfiguration())
      hashCode = hashCode * 8191 + configuration.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetClient_protocol(), other.isSetClient_protocol());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetClient_protocol()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.client_protocol, other.client_protocol);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetZoneId(), other.isSetZoneId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetZoneId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.zoneId, other.zoneId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetUsername(), other.isSetUsername());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetUsername()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, other.username);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPassword(), other.isSetPassword());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPassword()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, other.password);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetConfiguration(), other.isSetConfiguration());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetConfiguration()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.configuration, other.configuration);
      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("TSOpenSessionReq(");
    boolean first = true;

    sb.append("client_protocol:");
    if (this.client_protocol == null) {
      sb.append("null");
    } else {
      sb.append(this.client_protocol);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("zoneId:");
    if (this.zoneId == null) {
      sb.append("null");
    } else {
      sb.append(this.zoneId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("username:");
    if (this.username == null) {
      sb.append("null");
    } else {
      sb.append(this.username);
    }
    first = false;
    if (isSetPassword()) {
      if (!first) sb.append(", ");
      sb.append("password:");
      if (this.password == null) {
        sb.append("null");
      } else {
        sb.append(this.password);
      }
      first = false;
    }
    if (isSetConfiguration()) {
      if (!first) sb.append(", ");
      sb.append("configuration:");
      if (this.configuration == null) {
        sb.append("null");
      } else {
        sb.append(this.configuration);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

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

  private static class TSOpenSessionReqStandardScheme extends org.apache.thrift.scheme.StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSOpenSessionReq 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: // CLIENT_PROTOCOL
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.client_protocol = org.apache.iotdb.service.rpc.thrift.TSProtocolVersion.findByValue(iprot.readI32());
              struct.setClient_protocolIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ZONE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.zoneId = iprot.readString();
              struct.setZoneIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // USERNAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.username = iprot.readString();
              struct.setUsernameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PASSWORD
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.password = iprot.readString();
              struct.setPasswordIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // CONFIGURATION
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map108 = iprot.readMapBegin();
                struct.configuration = new java.util.HashMap(2*_map108.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key109;
                @org.apache.thrift.annotation.Nullable java.lang.String _val110;
                for (int _i111 = 0; _i111 < _map108.size; ++_i111)
                {
                  _key109 = iprot.readString();
                  _val110 = iprot.readString();
                  struct.configuration.put(_key109, _val110);
                }
                iprot.readMapEnd();
              }
              struct.setConfigurationIsSet(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, TSOpenSessionReq struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.client_protocol != null) {
        oprot.writeFieldBegin(CLIENT_PROTOCOL_FIELD_DESC);
        oprot.writeI32(struct.client_protocol.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.zoneId != null) {
        oprot.writeFieldBegin(ZONE_ID_FIELD_DESC);
        oprot.writeString(struct.zoneId);
        oprot.writeFieldEnd();
      }
      if (struct.username != null) {
        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
        oprot.writeString(struct.username);
        oprot.writeFieldEnd();
      }
      if (struct.password != null) {
        if (struct.isSetPassword()) {
          oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
          oprot.writeString(struct.password);
          oprot.writeFieldEnd();
        }
      }
      if (struct.configuration != null) {
        if (struct.isSetConfiguration()) {
          oprot.writeFieldBegin(CONFIGURATION_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.configuration.size()));
            for (java.util.Map.Entry _iter112 : struct.configuration.entrySet())
            {
              oprot.writeString(_iter112.getKey());
              oprot.writeString(_iter112.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TSOpenSessionReqTupleScheme extends org.apache.thrift.scheme.TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSOpenSessionReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI32(struct.client_protocol.getValue());
      oprot.writeString(struct.zoneId);
      oprot.writeString(struct.username);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetPassword()) {
        optionals.set(0);
      }
      if (struct.isSetConfiguration()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetPassword()) {
        oprot.writeString(struct.password);
      }
      if (struct.isSetConfiguration()) {
        {
          oprot.writeI32(struct.configuration.size());
          for (java.util.Map.Entry _iter113 : struct.configuration.entrySet())
          {
            oprot.writeString(_iter113.getKey());
            oprot.writeString(_iter113.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSOpenSessionReq struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.client_protocol = org.apache.iotdb.service.rpc.thrift.TSProtocolVersion.findByValue(iprot.readI32());
      struct.setClient_protocolIsSet(true);
      struct.zoneId = iprot.readString();
      struct.setZoneIdIsSet(true);
      struct.username = iprot.readString();
      struct.setUsernameIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.password = iprot.readString();
        struct.setPasswordIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TMap _map114 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING); 
          struct.configuration = new java.util.HashMap(2*_map114.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key115;
          @org.apache.thrift.annotation.Nullable java.lang.String _val116;
          for (int _i117 = 0; _i117 < _map114.size; ++_i117)
          {
            _key115 = iprot.readString();
            _val116 = iprot.readString();
            struct.configuration.put(_key115, _val116);
          }
        }
        struct.setConfigurationIsSet(true);
      }
    }
  }

  private static  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();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy