コード例 #1
0
  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.table != null) {
      oprot.writeFieldBegin(TABLE_FIELD_DESC);
      oprot.writeString(this.table);
      oprot.writeFieldEnd();
    }
    if (this.key != null) {
      oprot.writeFieldBegin(KEY_FIELD_DESC);
      oprot.writeString(this.key);
      oprot.writeFieldEnd();
    }
    if (this.cfmap != null) {
      oprot.writeFieldBegin(CFMAP_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, this.cfmap.size()));
        for (Map.Entry<String, List<superColumn_t>> _iter36 : this.cfmap.entrySet()) {
          oprot.writeString(_iter36.getKey());
          {
            oprot.writeListBegin(new TList(TType.STRUCT, _iter36.getValue().size()));
            for (superColumn_t _iter37 : _iter36.getValue()) {
              _iter37.write(oprot);
            }
            oprot.writeListEnd();
          }
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.cfmapdel != null) {
      oprot.writeFieldBegin(CFMAPDEL_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.STRING, TType.LIST, this.cfmapdel.size()));
        for (Map.Entry<String, List<superColumn_t>> _iter38 : this.cfmapdel.entrySet()) {
          oprot.writeString(_iter38.getKey());
          {
            oprot.writeListBegin(new TList(TType.STRUCT, _iter38.getValue().size()));
            for (superColumn_t _iter39 : _iter38.getValue()) {
              _iter39.write(oprot);
            }
            oprot.writeListEnd();
          }
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }
コード例 #2
0
  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true) {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) {
        break;
      }
      switch (field.id) {
        case TABLE:
          if (field.type == TType.STRING) {
            this.table = iprot.readString();
            this.__isset.table = true;
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case KEY:
          if (field.type == TType.STRING) {
            this.key = iprot.readString();
            this.__isset.key = true;
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case CFMAP:
          if (field.type == TType.MAP) {
            {
              TMap _map22 = iprot.readMapBegin();
              this.cfmap = new HashMap<String, List<superColumn_t>>(2 * _map22.size);
              for (int _i23 = 0; _i23 < _map22.size; ++_i23) {
                String _key24;
                List<superColumn_t> _val25;
                _key24 = iprot.readString();
                {
                  TList _list26 = iprot.readListBegin();
                  _val25 = new ArrayList<superColumn_t>(_list26.size);
                  for (int _i27 = 0; _i27 < _list26.size; ++_i27) {
                    superColumn_t _elem28;
                    _elem28 = new superColumn_t();
                    _elem28.read(iprot);
                    _val25.add(_elem28);
                  }
                  iprot.readListEnd();
                }
                this.cfmap.put(_key24, _val25);
              }
              iprot.readMapEnd();
            }
            this.__isset.cfmap = true;
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case CFMAPDEL:
          if (field.type == TType.MAP) {
            {
              TMap _map29 = iprot.readMapBegin();
              this.cfmapdel = new HashMap<String, List<superColumn_t>>(2 * _map29.size);
              for (int _i30 = 0; _i30 < _map29.size; ++_i30) {
                String _key31;
                List<superColumn_t> _val32;
                _key31 = iprot.readString();
                {
                  TList _list33 = iprot.readListBegin();
                  _val32 = new ArrayList<superColumn_t>(_list33.size);
                  for (int _i34 = 0; _i34 < _list33.size; ++_i34) {
                    superColumn_t _elem35;
                    _elem35 = new superColumn_t();
                    _elem35.read(iprot);
                    _val32.add(_elem35);
                  }
                  iprot.readListEnd();
                }
                this.cfmapdel.put(_key31, _val32);
              }
              iprot.readMapEnd();
            }
            this.__isset.cfmapdel = true;
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }