Esempio n. 1
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, InteractionTask struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(IID_FIELD_DESC);
      oprot.writeI32(struct.iid);
      oprot.writeFieldEnd();
      if (struct.input != null) {
        oprot.writeFieldBegin(INPUT_FIELD_DESC);
        oprot.writeI32(struct.input.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.structure != null) {
        oprot.writeFieldBegin(STRUCTURE_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRING, struct.structure.size()));
          for (String _iter33 : struct.structure) {
            oprot.writeString(_iter33);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.preset != null) {
        oprot.writeFieldBegin(PRESET_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRING, struct.preset.size()));
          for (String _iter34 : struct.preset) {
            oprot.writeString(_iter34);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.output != null) {
        oprot.writeFieldBegin(OUTPUT_FIELD_DESC);
        oprot.writeI32(struct.output.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.data != null) {
        oprot.writeFieldBegin(DATA_FIELD_DESC);
        {
          oprot.writeListBegin(
              new org.apache.thrift.protocol.TList(
                  org.apache.thrift.protocol.TType.STRING, struct.data.size()));
          for (String _iter35 : struct.data) {
            oprot.writeString(_iter35);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.title != null) {
        oprot.writeFieldBegin(TITLE_FIELD_DESC);
        oprot.writeString(struct.title);
        oprot.writeFieldEnd();
      }
      if (struct.description != null) {
        oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
        oprot.writeString(struct.description);
        oprot.writeFieldEnd();
      }
      if (struct.plugin != null) {
        oprot.writeFieldBegin(PLUGIN_FIELD_DESC);
        oprot.writeString(struct.plugin);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Esempio n. 2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, InteractionTask struct)
        throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true) {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
          break;
        }
        switch (schemeField.id) {
          case 1: // IID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.iid = iprot.readI32();
              struct.setIidIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // INPUT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.input = Input.findByValue(iprot.readI32());
              struct.setInputIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // STRUCTURE
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
                struct.structure = new ArrayList<String>(_list24.size);
                for (int _i25 = 0; _i25 < _list24.size; ++_i25) {
                  String _elem26; // required
                  _elem26 = iprot.readString();
                  struct.structure.add(_elem26);
                }
                iprot.readListEnd();
              }
              struct.setStructureIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // PRESET
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list27 = iprot.readListBegin();
                struct.preset = new ArrayList<String>(_list27.size);
                for (int _i28 = 0; _i28 < _list27.size; ++_i28) {
                  String _elem29; // required
                  _elem29 = iprot.readString();
                  struct.preset.add(_elem29);
                }
                iprot.readListEnd();
              }
              struct.setPresetIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // OUTPUT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.output = Output.findByValue(iprot.readI32());
              struct.setOutputIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // DATA
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list30 = iprot.readListBegin();
                struct.data = new ArrayList<String>(_list30.size);
                for (int _i31 = 0; _i31 < _list30.size; ++_i31) {
                  String _elem32; // required
                  _elem32 = iprot.readString();
                  struct.data.add(_elem32);
                }
                iprot.readListEnd();
              }
              struct.setDataIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // TITLE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.title = iprot.readString();
              struct.setTitleIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // DESCRIPTION
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.description = iprot.readString();
              struct.setDescriptionIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // PLUGIN
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.plugin = iprot.readString();
              struct.setPluginIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

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