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

org.apache.iotdb.service.rpc.thrift.TSConnectionInfo 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 = "2024-09-12")
public class TSConnectionInfo 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("TSConnectionInfo");

  private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField LOG_IN_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("logInTime", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField CONNECTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("connectionId", org.apache.thrift.protocol.TType.STRING, (short)3);
  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)4);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String userName; // required
  public long logInTime; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String connectionId; // required
  /**
   * 
   * @see TSConnectionType
   */
  public @org.apache.thrift.annotation.Nullable TSConnectionType type; // 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 {
    USER_NAME((short)1, "userName"),
    LOG_IN_TIME((short)2, "logInTime"),
    CONNECTION_ID((short)3, "connectionId"),
    /**
     * 
     * @see TSConnectionType
     */
    TYPE((short)4, "type");

    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: // USER_NAME
          return USER_NAME;
        case 2: // LOG_IN_TIME
          return LOG_IN_TIME;
        case 3: // CONNECTION_ID
          return CONNECTION_ID;
        case 4: // TYPE
          return TYPE;
        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 int __LOGINTIME_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  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.USER_NAME, 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.LOG_IN_TIME, new org.apache.thrift.meta_data.FieldMetaData("logInTime", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.CONNECTION_ID, new org.apache.thrift.meta_data.FieldMetaData("connectionId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    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, TSConnectionType.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSConnectionInfo.class, metaDataMap);
  }

  public TSConnectionInfo() {
  }

  public TSConnectionInfo(
    java.lang.String userName,
    long logInTime,
    java.lang.String connectionId,
    TSConnectionType type)
  {
    this();
    this.userName = userName;
    this.logInTime = logInTime;
    setLogInTimeIsSet(true);
    this.connectionId = connectionId;
    this.type = type;
  }

  /**
   * Performs a deep copy on other.
   */
  public TSConnectionInfo(TSConnectionInfo other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetUserName()) {
      this.userName = other.userName;
    }
    this.logInTime = other.logInTime;
    if (other.isSetConnectionId()) {
      this.connectionId = other.connectionId;
    }
    if (other.isSetType()) {
      this.type = other.type;
    }
  }

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

  @Override
  public void clear() {
    this.userName = null;
    setLogInTimeIsSet(false);
    this.logInTime = 0;
    this.connectionId = null;
    this.type = null;
  }

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

  public TSConnectionInfo 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;
    }
  }

  public long getLogInTime() {
    return this.logInTime;
  }

  public TSConnectionInfo setLogInTime(long logInTime) {
    this.logInTime = logInTime;
    setLogInTimeIsSet(true);
    return this;
  }

  public void unsetLogInTime() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LOGINTIME_ISSET_ID);
  }

  /** Returns true if field logInTime is set (has been assigned a value) and false otherwise */
  public boolean isSetLogInTime() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LOGINTIME_ISSET_ID);
  }

  public void setLogInTimeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LOGINTIME_ISSET_ID, value);
  }

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

  public TSConnectionInfo setConnectionId(@org.apache.thrift.annotation.Nullable java.lang.String connectionId) {
    this.connectionId = connectionId;
    return this;
  }

  public void unsetConnectionId() {
    this.connectionId = null;
  }

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

  public void setConnectionIdIsSet(boolean value) {
    if (!value) {
      this.connectionId = null;
    }
  }

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

  /**
   * 
   * @see TSConnectionType
   */
  public TSConnectionInfo setType(@org.apache.thrift.annotation.Nullable TSConnectionType 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 void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case USER_NAME:
      if (value == null) {
        unsetUserName();
      } else {
        setUserName((java.lang.String)value);
      }
      break;

    case LOG_IN_TIME:
      if (value == null) {
        unsetLogInTime();
      } else {
        setLogInTime((java.lang.Long)value);
      }
      break;

    case CONNECTION_ID:
      if (value == null) {
        unsetConnectionId();
      } else {
        setConnectionId((java.lang.String)value);
      }
      break;

    case TYPE:
      if (value == null) {
        unsetType();
      } else {
        setType((TSConnectionType)value);
      }
      break;

    }
  }

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

    case LOG_IN_TIME:
      return getLogInTime();

    case CONNECTION_ID:
      return getConnectionId();

    case TYPE:
      return getType();

    }
    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 USER_NAME:
      return isSetUserName();
    case LOG_IN_TIME:
      return isSetLogInTime();
    case CONNECTION_ID:
      return isSetConnectionId();
    case TYPE:
      return isSetType();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    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_logInTime = true;
    boolean that_present_logInTime = true;
    if (this_present_logInTime || that_present_logInTime) {
      if (!(this_present_logInTime && that_present_logInTime))
        return false;
      if (this.logInTime != that.logInTime)
        return false;
    }

    boolean this_present_connectionId = true && this.isSetConnectionId();
    boolean that_present_connectionId = true && that.isSetConnectionId();
    if (this_present_connectionId || that_present_connectionId) {
      if (!(this_present_connectionId && that_present_connectionId))
        return false;
      if (!this.connectionId.equals(that.connectionId))
        return false;
    }

    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;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetUserName()) ? 131071 : 524287);
    if (isSetUserName())
      hashCode = hashCode * 8191 + userName.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(logInTime);

    hashCode = hashCode * 8191 + ((isSetConnectionId()) ? 131071 : 524287);
    if (isSetConnectionId())
      hashCode = hashCode * 8191 + connectionId.hashCode();

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

    return hashCode;
  }

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

    int lastComparison = 0;

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

    sb.append("userName:");
    if (this.userName == null) {
      sb.append("null");
    } else {
      sb.append(this.userName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("logInTime:");
    sb.append(this.logInTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("connectionId:");
    if (this.connectionId == null) {
      sb.append("null");
    } else {
      sb.append(this.connectionId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("type:");
    if (this.type == null) {
      sb.append("null");
    } else {
      sb.append(this.type);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (userName == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'userName' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'logInTime' because it's a primitive and you chose the non-beans generator.
    if (connectionId == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'connectionId' was not present! Struct: " + toString());
    }
    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 {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      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 TSConnectionInfoStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSConnectionInfoStandardScheme getScheme() {
      return new TSConnectionInfoStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSConnectionInfo 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: // USER_NAME
            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 2: // LOG_IN_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.logInTime = iprot.readI64();
              struct.setLogInTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // CONNECTION_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.connectionId = iprot.readString();
              struct.setConnectionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = org.apache.iotdb.service.rpc.thrift.TSConnectionType.findByValue(iprot.readI32());
              struct.setTypeIsSet(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
      if (!struct.isSetLogInTime()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'logInTime' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TSConnectionInfo struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.userName != null) {
        oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
        oprot.writeString(struct.userName);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(LOG_IN_TIME_FIELD_DESC);
      oprot.writeI64(struct.logInTime);
      oprot.writeFieldEnd();
      if (struct.connectionId != null) {
        oprot.writeFieldBegin(CONNECTION_ID_FIELD_DESC);
        oprot.writeString(struct.connectionId);
        oprot.writeFieldEnd();
      }
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSConnectionInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.userName);
      oprot.writeI64(struct.logInTime);
      oprot.writeString(struct.connectionId);
      oprot.writeI32(struct.type.getValue());
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSConnectionInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.userName = iprot.readString();
      struct.setUserNameIsSet(true);
      struct.logInTime = iprot.readI64();
      struct.setLogInTimeIsSet(true);
      struct.connectionId = iprot.readString();
      struct.setConnectionIdIsSet(true);
      struct.type = org.apache.iotdb.service.rpc.thrift.TSConnectionType.findByValue(iprot.readI32());
      struct.setTypeIsSet(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