Пример #1
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, JSONField struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetString_val()) {
     optionals.set(0);
   }
   if (struct.isSetBool_val()) {
     optionals.set(1);
   }
   if (struct.isSetI32_val()) {
     optionals.set(2);
   }
   if (struct.isSetI64_val()) {
     optionals.set(3);
   }
   if (struct.isSetDouble_val()) {
     optionals.set(4);
   }
   if (struct.isSetNull_val()) {
     optionals.set(5);
   }
   if (struct.isSetRef_val()) {
     optionals.set(6);
   }
   if (struct.isSetArray_val()) {
     optionals.set(7);
   }
   oprot.writeBitSet(optionals, 8);
   if (struct.isSetString_val()) {
     oprot.writeString(struct.string_val);
   }
   if (struct.isSetBool_val()) {
     oprot.writeBool(struct.bool_val);
   }
   if (struct.isSetI32_val()) {
     oprot.writeI32(struct.i32_val);
   }
   if (struct.isSetI64_val()) {
     oprot.writeI64(struct.i64_val);
   }
   if (struct.isSetDouble_val()) {
     oprot.writeDouble(struct.double_val);
   }
   if (struct.isSetNull_val()) {
     oprot.writeBool(struct.null_val);
   }
   if (struct.isSetRef_val()) {
     oprot.writeI32(struct.ref_val);
   }
   if (struct.isSetArray_val()) {
     {
       oprot.writeI32(struct.array_val.size());
       for (int _iter116 : struct.array_val) {
         oprot.writeI32(_iter116);
       }
     }
   }
 }
Пример #2
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, JSONField struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.string_val != null) {
        if (struct.isSetString_val()) {
          oprot.writeFieldBegin(STRING_VAL_FIELD_DESC);
          oprot.writeString(struct.string_val);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetBool_val()) {
        oprot.writeFieldBegin(BOOL_VAL_FIELD_DESC);
        oprot.writeBool(struct.bool_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetI32_val()) {
        oprot.writeFieldBegin(I32_VAL_FIELD_DESC);
        oprot.writeI32(struct.i32_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetI64_val()) {
        oprot.writeFieldBegin(I64_VAL_FIELD_DESC);
        oprot.writeI64(struct.i64_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetDouble_val()) {
        oprot.writeFieldBegin(DOUBLE_VAL_FIELD_DESC);
        oprot.writeDouble(struct.double_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetNull_val()) {
        oprot.writeFieldBegin(NULL_VAL_FIELD_DESC);
        oprot.writeBool(struct.null_val);
        oprot.writeFieldEnd();
      }
      if (struct.isSetRef_val()) {
        oprot.writeFieldBegin(REF_VAL_FIELD_DESC);
        oprot.writeI32(struct.ref_val);
        oprot.writeFieldEnd();
      }
      if (struct.array_val != null) {
        if (struct.isSetArray_val()) {
          oprot.writeFieldBegin(ARRAY_VAL_FIELD_DESC);
          {
            oprot.writeListBegin(
                new org.apache.thrift.protocol.TList(
                    org.apache.thrift.protocol.TType.I32, struct.array_val.size()));
            for (int _iter115 : struct.array_val) {
              oprot.writeI32(_iter115);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Пример #3
0
  @Override
  public int compareTo(JSONField other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetString_val()).compareTo(other.isSetString_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetString_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.string_val, other.string_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBool_val()).compareTo(other.isSetBool_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBool_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bool_val, other.bool_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetI32_val()).compareTo(other.isSetI32_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI32_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i32_val, other.i32_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetI64_val()).compareTo(other.isSetI64_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetI64_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.i64_val, other.i64_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetDouble_val()).compareTo(other.isSetDouble_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetDouble_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.double_val, other.double_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetNull_val()).compareTo(other.isSetNull_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetNull_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.null_val, other.null_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetRef_val()).compareTo(other.isSetRef_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRef_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ref_val, other.ref_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetArray_val()).compareTo(other.isSetArray_val());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetArray_val()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.array_val, other.array_val);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
Пример #4
0
  public boolean equals(JSONField that) {
    if (that == null) return false;

    boolean this_present_string_val = true && this.isSetString_val();
    boolean that_present_string_val = true && that.isSetString_val();
    if (this_present_string_val || that_present_string_val) {
      if (!(this_present_string_val && that_present_string_val)) return false;
      if (!this.string_val.equals(that.string_val)) return false;
    }

    boolean this_present_bool_val = true && this.isSetBool_val();
    boolean that_present_bool_val = true && that.isSetBool_val();
    if (this_present_bool_val || that_present_bool_val) {
      if (!(this_present_bool_val && that_present_bool_val)) return false;
      if (this.bool_val != that.bool_val) return false;
    }

    boolean this_present_i32_val = true && this.isSetI32_val();
    boolean that_present_i32_val = true && that.isSetI32_val();
    if (this_present_i32_val || that_present_i32_val) {
      if (!(this_present_i32_val && that_present_i32_val)) return false;
      if (this.i32_val != that.i32_val) return false;
    }

    boolean this_present_i64_val = true && this.isSetI64_val();
    boolean that_present_i64_val = true && that.isSetI64_val();
    if (this_present_i64_val || that_present_i64_val) {
      if (!(this_present_i64_val && that_present_i64_val)) return false;
      if (this.i64_val != that.i64_val) return false;
    }

    boolean this_present_double_val = true && this.isSetDouble_val();
    boolean that_present_double_val = true && that.isSetDouble_val();
    if (this_present_double_val || that_present_double_val) {
      if (!(this_present_double_val && that_present_double_val)) return false;
      if (this.double_val != that.double_val) return false;
    }

    boolean this_present_null_val = true && this.isSetNull_val();
    boolean that_present_null_val = true && that.isSetNull_val();
    if (this_present_null_val || that_present_null_val) {
      if (!(this_present_null_val && that_present_null_val)) return false;
      if (this.null_val != that.null_val) return false;
    }

    boolean this_present_ref_val = true && this.isSetRef_val();
    boolean that_present_ref_val = true && that.isSetRef_val();
    if (this_present_ref_val || that_present_ref_val) {
      if (!(this_present_ref_val && that_present_ref_val)) return false;
      if (this.ref_val != that.ref_val) return false;
    }

    boolean this_present_array_val = true && this.isSetArray_val();
    boolean that_present_array_val = true && that.isSetArray_val();
    if (this_present_array_val || that_present_array_val) {
      if (!(this_present_array_val && that_present_array_val)) return false;
      if (!this.array_val.equals(that.array_val)) return false;
    }

    return true;
  }