Пример #1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, KsDef 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.strategy_class != null) {
        oprot.writeFieldBegin(STRATEGY_CLASS_FIELD_DESC);
        oprot.writeString(struct.strategy_class);
        oprot.writeFieldEnd();
      }
      if (struct.strategy_options != null) {
        if (struct.isSetStrategy_options()) {
          oprot.writeFieldBegin(STRATEGY_OPTIONS_FIELD_DESC);
          {
            oprot.writeMapBegin(
                new org.apache.thrift.protocol.TMap(
                    org.apache.thrift.protocol.TType.STRING,
                    org.apache.thrift.protocol.TType.STRING,
                    struct.strategy_options.size()));
            for (Map.Entry<String, String> _iter81 : struct.strategy_options.entrySet()) {
              oprot.writeString(_iter81.getKey());
              oprot.writeString(_iter81.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetReplication_factor()) {
        oprot.writeFieldBegin(REPLICATION_FACTOR_FIELD_DESC);
        oprot.writeI32(struct.replication_factor);
        oprot.writeFieldEnd();
      }
      if (struct.cf_defs != null) {
        oprot.writeFieldBegin(CF_DEFS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.cf_defs.size()));
          for (CfDef _iter82 : struct.cf_defs) {
            _iter82.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.isSetDurable_writes()) {
        oprot.writeFieldBegin(DURABLE_WRITES_FIELD_DESC);
        oprot.writeBool(struct.durable_writes);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Пример #2
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, KsDef struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   oprot.writeString(struct.name);
   oprot.writeString(struct.strategy_class);
   {
     oprot.writeI32(struct.cf_defs.size());
     for (CfDef _iter83 : struct.cf_defs) {
       _iter83.write(oprot);
     }
   }
   BitSet optionals = new BitSet();
   if (struct.isSetStrategy_options()) {
     optionals.set(0);
   }
   if (struct.isSetReplication_factor()) {
     optionals.set(1);
   }
   if (struct.isSetDurable_writes()) {
     optionals.set(2);
   }
   oprot.writeBitSet(optionals, 3);
   if (struct.isSetStrategy_options()) {
     {
       oprot.writeI32(struct.strategy_options.size());
       for (Map.Entry<String, String> _iter84 : struct.strategy_options.entrySet()) {
         oprot.writeString(_iter84.getKey());
         oprot.writeString(_iter84.getValue());
       }
     }
   }
   if (struct.isSetReplication_factor()) {
     oprot.writeI32(struct.replication_factor);
   }
   if (struct.isSetDurable_writes()) {
     oprot.writeBool(struct.durable_writes);
   }
 }