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

org.apache.iotdb.cluster.rpc.thrift.MeasurementSchemaRequest Maven / Gradle / Ivy

/**
 * 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.cluster.rpc.thrift;

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

  private static final org.apache.thrift.protocol.TField QUERY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("queryId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField HEADER_FIELD_DESC = new org.apache.thrift.protocol.TField("header", org.apache.thrift.protocol.TType.STRUCT, (short)2);
  private static final org.apache.thrift.protocol.TField REQUESTER_FIELD_DESC = new org.apache.thrift.protocol.TField("requester", org.apache.thrift.protocol.TType.STRUCT, (short)3);
  private static final org.apache.thrift.protocol.TField PLAN_BINARY_FIELD_DESC = new org.apache.thrift.protocol.TField("planBinary", org.apache.thrift.protocol.TType.STRING, (short)4);

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

  public long queryId; // required
  public @org.apache.thrift.annotation.Nullable RaftNode header; // required
  public @org.apache.thrift.annotation.Nullable Node requester; // required
  public @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer planBinary; // 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 {
    QUERY_ID((short)1, "queryId"),
    HEADER((short)2, "header"),
    REQUESTER((short)3, "requester"),
    PLAN_BINARY((short)4, "planBinary");

    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: // QUERY_ID
          return QUERY_ID;
        case 2: // HEADER
          return HEADER;
        case 3: // REQUESTER
          return REQUESTER;
        case 4: // PLAN_BINARY
          return PLAN_BINARY;
        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 __QUERYID_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.QUERY_ID, new org.apache.thrift.meta_data.FieldMetaData("queryId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "long")));
    tmpMap.put(_Fields.HEADER, new org.apache.thrift.meta_data.FieldMetaData("header", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RaftNode.class)));
    tmpMap.put(_Fields.REQUESTER, new org.apache.thrift.meta_data.FieldMetaData("requester", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Node.class)));
    tmpMap.put(_Fields.PLAN_BINARY, new org.apache.thrift.meta_data.FieldMetaData("planBinary", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(MeasurementSchemaRequest.class, metaDataMap);
  }

  public MeasurementSchemaRequest() {
  }

  public MeasurementSchemaRequest(
    long queryId,
    RaftNode header,
    Node requester,
    java.nio.ByteBuffer planBinary)
  {
    this();
    this.queryId = queryId;
    setQueryIdIsSet(true);
    this.header = header;
    this.requester = requester;
    this.planBinary = org.apache.thrift.TBaseHelper.copyBinary(planBinary);
  }

  /**
   * Performs a deep copy on other.
   */
  public MeasurementSchemaRequest(MeasurementSchemaRequest other) {
    __isset_bitfield = other.__isset_bitfield;
    this.queryId = other.queryId;
    if (other.isSetHeader()) {
      this.header = new RaftNode(other.header);
    }
    if (other.isSetRequester()) {
      this.requester = new Node(other.requester);
    }
    if (other.isSetPlanBinary()) {
      this.planBinary = org.apache.thrift.TBaseHelper.copyBinary(other.planBinary);
    }
  }

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

  @Override
  public void clear() {
    setQueryIdIsSet(false);
    this.queryId = 0;
    this.header = null;
    this.requester = null;
    this.planBinary = null;
  }

  public long getQueryId() {
    return this.queryId;
  }

  public MeasurementSchemaRequest setQueryId(long queryId) {
    this.queryId = queryId;
    setQueryIdIsSet(true);
    return this;
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public RaftNode getHeader() {
    return this.header;
  }

  public MeasurementSchemaRequest setHeader(@org.apache.thrift.annotation.Nullable RaftNode header) {
    this.header = header;
    return this;
  }

  public void unsetHeader() {
    this.header = null;
  }

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

  public void setHeaderIsSet(boolean value) {
    if (!value) {
      this.header = null;
    }
  }

  @org.apache.thrift.annotation.Nullable
  public Node getRequester() {
    return this.requester;
  }

  public MeasurementSchemaRequest setRequester(@org.apache.thrift.annotation.Nullable Node requester) {
    this.requester = requester;
    return this;
  }

  public void unsetRequester() {
    this.requester = null;
  }

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

  public void setRequesterIsSet(boolean value) {
    if (!value) {
      this.requester = null;
    }
  }

  public byte[] getPlanBinary() {
    setPlanBinary(org.apache.thrift.TBaseHelper.rightSize(planBinary));
    return planBinary == null ? null : planBinary.array();
  }

  public java.nio.ByteBuffer bufferForPlanBinary() {
    return org.apache.thrift.TBaseHelper.copyBinary(planBinary);
  }

  public MeasurementSchemaRequest setPlanBinary(byte[] planBinary) {
    this.planBinary = planBinary == null ? (java.nio.ByteBuffer)null   : java.nio.ByteBuffer.wrap(planBinary.clone());
    return this;
  }

  public MeasurementSchemaRequest setPlanBinary(@org.apache.thrift.annotation.Nullable java.nio.ByteBuffer planBinary) {
    this.planBinary = org.apache.thrift.TBaseHelper.copyBinary(planBinary);
    return this;
  }

  public void unsetPlanBinary() {
    this.planBinary = null;
  }

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

  public void setPlanBinaryIsSet(boolean value) {
    if (!value) {
      this.planBinary = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case QUERY_ID:
      if (value == null) {
        unsetQueryId();
      } else {
        setQueryId((java.lang.Long)value);
      }
      break;

    case HEADER:
      if (value == null) {
        unsetHeader();
      } else {
        setHeader((RaftNode)value);
      }
      break;

    case REQUESTER:
      if (value == null) {
        unsetRequester();
      } else {
        setRequester((Node)value);
      }
      break;

    case PLAN_BINARY:
      if (value == null) {
        unsetPlanBinary();
      } else {
        if (value instanceof byte[]) {
          setPlanBinary((byte[])value);
        } else {
          setPlanBinary((java.nio.ByteBuffer)value);
        }
      }
      break;

    }
  }

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

    case HEADER:
      return getHeader();

    case REQUESTER:
      return getRequester();

    case PLAN_BINARY:
      return getPlanBinary();

    }
    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 QUERY_ID:
      return isSetQueryId();
    case HEADER:
      return isSetHeader();
    case REQUESTER:
      return isSetRequester();
    case PLAN_BINARY:
      return isSetPlanBinary();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_queryId = true;
    boolean that_present_queryId = true;
    if (this_present_queryId || that_present_queryId) {
      if (!(this_present_queryId && that_present_queryId))
        return false;
      if (this.queryId != that.queryId)
        return false;
    }

    boolean this_present_header = true && this.isSetHeader();
    boolean that_present_header = true && that.isSetHeader();
    if (this_present_header || that_present_header) {
      if (!(this_present_header && that_present_header))
        return false;
      if (!this.header.equals(that.header))
        return false;
    }

    boolean this_present_requester = true && this.isSetRequester();
    boolean that_present_requester = true && that.isSetRequester();
    if (this_present_requester || that_present_requester) {
      if (!(this_present_requester && that_present_requester))
        return false;
      if (!this.requester.equals(that.requester))
        return false;
    }

    boolean this_present_planBinary = true && this.isSetPlanBinary();
    boolean that_present_planBinary = true && that.isSetPlanBinary();
    if (this_present_planBinary || that_present_planBinary) {
      if (!(this_present_planBinary && that_present_planBinary))
        return false;
      if (!this.planBinary.equals(that.planBinary))
        return false;
    }

    return true;
  }

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

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

    hashCode = hashCode * 8191 + ((isSetHeader()) ? 131071 : 524287);
    if (isSetHeader())
      hashCode = hashCode * 8191 + header.hashCode();

    hashCode = hashCode * 8191 + ((isSetRequester()) ? 131071 : 524287);
    if (isSetRequester())
      hashCode = hashCode * 8191 + requester.hashCode();

    hashCode = hashCode * 8191 + ((isSetPlanBinary()) ? 131071 : 524287);
    if (isSetPlanBinary())
      hashCode = hashCode * 8191 + planBinary.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetQueryId(), other.isSetQueryId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetQueryId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.queryId, other.queryId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetHeader(), other.isSetHeader());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHeader()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.header, other.header);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetRequester(), other.isSetRequester());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRequester()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requester, other.requester);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetPlanBinary(), other.isSetPlanBinary());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPlanBinary()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.planBinary, other.planBinary);
      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("MeasurementSchemaRequest(");
    boolean first = true;

    sb.append("queryId:");
    sb.append(this.queryId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("header:");
    if (this.header == null) {
      sb.append("null");
    } else {
      sb.append(this.header);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("requester:");
    if (this.requester == null) {
      sb.append("null");
    } else {
      sb.append(this.requester);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("planBinary:");
    if (this.planBinary == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.planBinary, sb);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // alas, we cannot check 'queryId' because it's a primitive and you chose the non-beans generator.
    if (header == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'header' was not present! Struct: " + toString());
    }
    if (requester == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'requester' was not present! Struct: " + toString());
    }
    if (planBinary == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'planBinary' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (header != null) {
      header.validate();
    }
    if (requester != null) {
      requester.validate();
    }
  }

  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 MeasurementSchemaRequestStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public MeasurementSchemaRequestStandardScheme getScheme() {
      return new MeasurementSchemaRequestStandardScheme();
    }
  }

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, MeasurementSchemaRequest 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: // QUERY_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.queryId = iprot.readI64();
              struct.setQueryIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // HEADER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.header = new RaftNode();
              struct.header.read(iprot);
              struct.setHeaderIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // REQUESTER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.requester = new Node();
              struct.requester.read(iprot);
              struct.setRequesterIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PLAN_BINARY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.planBinary = iprot.readBinary();
              struct.setPlanBinaryIsSet(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.isSetQueryId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'queryId' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(QUERY_ID_FIELD_DESC);
      oprot.writeI64(struct.queryId);
      oprot.writeFieldEnd();
      if (struct.header != null) {
        oprot.writeFieldBegin(HEADER_FIELD_DESC);
        struct.header.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.requester != null) {
        oprot.writeFieldBegin(REQUESTER_FIELD_DESC);
        struct.requester.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.planBinary != null) {
        oprot.writeFieldBegin(PLAN_BINARY_FIELD_DESC);
        oprot.writeBinary(struct.planBinary);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, MeasurementSchemaRequest struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeI64(struct.queryId);
      struct.header.write(oprot);
      struct.requester.write(oprot);
      oprot.writeBinary(struct.planBinary);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, MeasurementSchemaRequest struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.queryId = iprot.readI64();
      struct.setQueryIdIsSet(true);
      struct.header = new RaftNode();
      struct.header.read(iprot);
      struct.setHeaderIsSet(true);
      struct.requester = new Node();
      struct.requester.read(iprot);
      struct.setRequesterIsSet(true);
      struct.planBinary = iprot.readBinary();
      struct.setPlanBinaryIsSet(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 - 2025 Weber Informatics LLC | Privacy Policy