Пример #1
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, Graph struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetNodeType()) {
     optionals.set(0);
   }
   if (struct.isSetRoots()) {
     optionals.set(1);
   }
   if (struct.isSetAdjacencyList()) {
     optionals.set(2);
   }
   oprot.writeBitSet(optionals, 3);
   if (struct.isSetNodeType()) {
     oprot.writeI32(struct.nodeType.getValue());
   }
   if (struct.isSetRoots()) {
     {
       oprot.writeI32(struct.roots.size());
       for (String _iter16 : struct.roots) {
         oprot.writeString(_iter16);
       }
     }
   }
   if (struct.isSetAdjacencyList()) {
     {
       oprot.writeI32(struct.adjacencyList.size());
       for (Adjacency _iter17 : struct.adjacencyList) {
         _iter17.write(oprot);
       }
     }
   }
 }
Пример #2
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, Graph struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.nodeType != null) {
        oprot.writeFieldBegin(NODE_TYPE_FIELD_DESC);
        oprot.writeI32(struct.nodeType.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.roots != null) {
        oprot.writeFieldBegin(ROOTS_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRING, struct.roots.size()));
          for (String _iter14 : struct.roots) {
            oprot.writeString(_iter14);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.adjacencyList != null) {
        oprot.writeFieldBegin(ADJACENCY_LIST_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRUCT, struct.adjacencyList.size()));
          for (Adjacency _iter15 : struct.adjacencyList) {
            _iter15.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }