Example #1
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TKey struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(5);
   if (incoming.get(0)) {
     struct.row = iprot.readBinary();
     struct.setRowIsSet(true);
   }
   if (incoming.get(1)) {
     struct.colFamily = iprot.readBinary();
     struct.setColFamilyIsSet(true);
   }
   if (incoming.get(2)) {
     struct.colQualifier = iprot.readBinary();
     struct.setColQualifierIsSet(true);
   }
   if (incoming.get(3)) {
     struct.colVisibility = iprot.readBinary();
     struct.setColVisibilityIsSet(true);
   }
   if (incoming.get(4)) {
     struct.timestamp = iprot.readI64();
     struct.setTimestampIsSet(true);
   }
 }
Example #2
0
 public void validate() throws org.apache.thrift.TException {
   // check for required fields
   // check for sub-struct validity
   if (start != null) {
     start.validate();
   }
   if (stop != null) {
     stop.validate();
   }
 }
Example #3
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, TKey struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.row != null) {
        oprot.writeFieldBegin(ROW_FIELD_DESC);
        oprot.writeBinary(struct.row);
        oprot.writeFieldEnd();
      }
      if (struct.colFamily != null) {
        oprot.writeFieldBegin(COL_FAMILY_FIELD_DESC);
        oprot.writeBinary(struct.colFamily);
        oprot.writeFieldEnd();
      }
      if (struct.colQualifier != null) {
        oprot.writeFieldBegin(COL_QUALIFIER_FIELD_DESC);
        oprot.writeBinary(struct.colQualifier);
        oprot.writeFieldEnd();
      }
      if (struct.colVisibility != null) {
        oprot.writeFieldBegin(COL_VISIBILITY_FIELD_DESC);
        oprot.writeBinary(struct.colVisibility);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
      oprot.writeI64(struct.timestamp);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Example #4
0
 /** Performs a deep copy on <i>other</i>. */
 public TKey(TKey other) {
   __isset_bitfield = other.__isset_bitfield;
   if (other.isSetRow()) {
     this.row = org.apache.thrift.TBaseHelper.copyBinary(other.row);
     ;
   }
   if (other.isSetColFamily()) {
     this.colFamily = org.apache.thrift.TBaseHelper.copyBinary(other.colFamily);
     ;
   }
   if (other.isSetColQualifier()) {
     this.colQualifier = org.apache.thrift.TBaseHelper.copyBinary(other.colQualifier);
     ;
   }
   if (other.isSetColVisibility()) {
     this.colVisibility = org.apache.thrift.TBaseHelper.copyBinary(other.colVisibility);
     ;
   }
   this.timestamp = other.timestamp;
 }
Example #5
0
  public boolean equals(TKey that) {
    if (that == null) return false;

    boolean this_present_row = true && this.isSetRow();
    boolean that_present_row = true && that.isSetRow();
    if (this_present_row || that_present_row) {
      if (!(this_present_row && that_present_row)) return false;
      if (!this.row.equals(that.row)) return false;
    }

    boolean this_present_colFamily = true && this.isSetColFamily();
    boolean that_present_colFamily = true && that.isSetColFamily();
    if (this_present_colFamily || that_present_colFamily) {
      if (!(this_present_colFamily && that_present_colFamily)) return false;
      if (!this.colFamily.equals(that.colFamily)) return false;
    }

    boolean this_present_colQualifier = true && this.isSetColQualifier();
    boolean that_present_colQualifier = true && that.isSetColQualifier();
    if (this_present_colQualifier || that_present_colQualifier) {
      if (!(this_present_colQualifier && that_present_colQualifier)) return false;
      if (!this.colQualifier.equals(that.colQualifier)) return false;
    }

    boolean this_present_colVisibility = true && this.isSetColVisibility();
    boolean that_present_colVisibility = true && that.isSetColVisibility();
    if (this_present_colVisibility || that_present_colVisibility) {
      if (!(this_present_colVisibility && that_present_colVisibility)) return false;
      if (!this.colVisibility.equals(that.colVisibility)) return false;
    }

    boolean this_present_timestamp = true;
    boolean that_present_timestamp = true;
    if (this_present_timestamp || that_present_timestamp) {
      if (!(this_present_timestamp && that_present_timestamp)) return false;
      if (this.timestamp != that.timestamp) return false;
    }

    return true;
  }
Example #6
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, TKey struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetRow()) {
     optionals.set(0);
   }
   if (struct.isSetColFamily()) {
     optionals.set(1);
   }
   if (struct.isSetColQualifier()) {
     optionals.set(2);
   }
   if (struct.isSetColVisibility()) {
     optionals.set(3);
   }
   if (struct.isSetTimestamp()) {
     optionals.set(4);
   }
   oprot.writeBitSet(optionals, 5);
   if (struct.isSetRow()) {
     oprot.writeBinary(struct.row);
   }
   if (struct.isSetColFamily()) {
     oprot.writeBinary(struct.colFamily);
   }
   if (struct.isSetColQualifier()) {
     oprot.writeBinary(struct.colQualifier);
   }
   if (struct.isSetColVisibility()) {
     oprot.writeBinary(struct.colVisibility);
   }
   if (struct.isSetTimestamp()) {
     oprot.writeI64(struct.timestamp);
   }
 }
Example #7
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, TKey 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: // ROW
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.row = iprot.readBinary();
              struct.setRowIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // COL_FAMILY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.colFamily = iprot.readBinary();
              struct.setColFamilyIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // COL_QUALIFIER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.colQualifier = iprot.readBinary();
              struct.setColQualifierIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // COL_VISIBILITY
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.colVisibility = iprot.readBinary();
              struct.setColVisibilityIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // TIMESTAMP
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.timestamp = iprot.readI64();
              struct.setTimestampIsSet(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();
    }
Example #8
0
  @Override
  public int compareTo(TKey other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetRow()).compareTo(other.isSetRow());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRow()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, other.row);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetColFamily()).compareTo(other.isSetColFamily());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColFamily()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.colFamily, other.colFamily);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetColQualifier()).compareTo(other.isSetColQualifier());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColQualifier()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.colQualifier, other.colQualifier);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetColVisibility()).compareTo(other.isSetColVisibility());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetColVisibility()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.colVisibility, other.colVisibility);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTimestamp()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }