public void toThrift(TColumnType container, TTypeNode node) {
   TStructField field = new TStructField();
   field.setName(name_);
   if (comment_ != null) field.setComment(comment_);
   node.struct_fields.add(field);
   type_.toThrift(container);
 }
Beispiel #2
0
  public int compareTo(TStructField other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    TStructField typedOther = (TStructField) other;

    lastComparison = Boolean.valueOf(isSetName()).compareTo(typedOther.isSetName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, typedOther.name);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetComment()).compareTo(typedOther.isSetComment());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetComment()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.comment, typedOther.comment);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Beispiel #3
0
 /** Performs a deep copy on <i>other</i>. */
 public TStructField(TStructField other) {
   if (other.isSetName()) {
     this.name = other.name;
   }
   if (other.isSetComment()) {
     this.comment = other.comment;
   }
 }
Beispiel #4
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TStructField struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   struct.name = iprot.readString();
   struct.setNameIsSet(true);
   BitSet incoming = iprot.readBitSet(1);
   if (incoming.get(0)) {
     struct.comment = iprot.readString();
     struct.setCommentIsSet(true);
   }
 }
Beispiel #5
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, TStructField struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   oprot.writeString(struct.name);
   BitSet optionals = new BitSet();
   if (struct.isSetComment()) {
     optionals.set(0);
   }
   oprot.writeBitSet(optionals, 1);
   if (struct.isSetComment()) {
     oprot.writeString(struct.comment);
   }
 }
Beispiel #6
0
  public boolean equals(TStructField that) {
    if (that == null) return false;

    boolean this_present_name = true && this.isSetName();
    boolean that_present_name = true && that.isSetName();
    if (this_present_name || that_present_name) {
      if (!(this_present_name && that_present_name)) return false;
      if (!this.name.equals(that.name)) return false;
    }

    boolean this_present_comment = true && this.isSetComment();
    boolean that_present_comment = true && that.isSetComment();
    if (this_present_comment || that_present_comment) {
      if (!(this_present_comment && that_present_comment)) return false;
      if (!this.comment.equals(that.comment)) return false;
    }

    return true;
  }
Beispiel #7
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, TStructField struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.name != null) {
        oprot.writeFieldBegin(NAME_FIELD_DESC);
        oprot.writeString(struct.name);
        oprot.writeFieldEnd();
      }
      if (struct.comment != null) {
        if (struct.isSetComment()) {
          oprot.writeFieldBegin(COMMENT_FIELD_DESC);
          oprot.writeString(struct.comment);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Beispiel #8
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, TStructField 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: // NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.name = iprot.readString();
              struct.setNameIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // COMMENT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.comment = iprot.readString();
              struct.setCommentIsSet(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();
    }