コード例 #1
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 1: // INTERPRETATIONS
          if (field.type == TType.LIST) {
            {
              TList _list44 = iprot.readListBegin();
              this.interpretations = new ArrayList<GeocodeInterpretation>(_list44.size);
              for (int _i45 = 0; _i45 < _list44.size; ++_i45) {
                GeocodeInterpretation _elem46;
                _elem46 = new GeocodeInterpretation();
                _elem46.read(iprot);
                this.interpretations.add(_elem46);
              }
              iprot.readListEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // DEBUG_LINES
          if (field.type == TType.LIST) {
            {
              TList _list47 = iprot.readListBegin();
              this.debugLines = new ArrayList<String>(_list47.size);
              for (int _i48 = 0; _i48 < _list47.size; ++_i48) {
                String _elem49;
                _elem49 = iprot.readString();
                this.debugLines.add(_elem49);
              }
              iprot.readListEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // REQUEST_WKT_GEOMETRY
          if (field.type == TType.STRING) {
            this.requestWktGeometry = iprot.readString();
          } else {
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }
コード例 #2
0
  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.interpretations != null) {
      oprot.writeFieldBegin(INTERPRETATIONS_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.interpretations.size()));
        for (GeocodeInterpretation _iter50 : this.interpretations) {
          _iter50.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.debugLines != null) {
      if (isSetDebugLines()) {
        oprot.writeFieldBegin(DEBUG_LINES_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRING, this.debugLines.size()));
          for (String _iter51 : this.debugLines) {
            oprot.writeString(_iter51);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
    }
    if (this.requestWktGeometry != null) {
      if (isSetRequestWktGeometry()) {
        oprot.writeFieldBegin(REQUEST_WKT_GEOMETRY_FIELD_DESC);
        oprot.writeString(this.requestWktGeometry);
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }