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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.type != null) {
        oprot.writeFieldBegin(TYPE_FIELD_DESC);
        oprot.writeI32(struct.type.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.stream_sink != null) {
        if (struct.isSetStream_sink()) {
          oprot.writeFieldBegin(STREAM_SINK_FIELD_DESC);
          struct.stream_sink.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.table_sink != null) {
        if (struct.isSetTable_sink()) {
          oprot.writeFieldBegin(TABLE_SINK_FIELD_DESC);
          struct.table_sink.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
Exemplo n.º 2
0
  public boolean equals(TDataSink that) {
    if (that == null) return false;

    boolean this_present_type = true && this.isSetType();
    boolean that_present_type = true && that.isSetType();
    if (this_present_type || that_present_type) {
      if (!(this_present_type && that_present_type)) return false;
      if (!this.type.equals(that.type)) return false;
    }

    boolean this_present_stream_sink = true && this.isSetStream_sink();
    boolean that_present_stream_sink = true && that.isSetStream_sink();
    if (this_present_stream_sink || that_present_stream_sink) {
      if (!(this_present_stream_sink && that_present_stream_sink)) return false;
      if (!this.stream_sink.equals(that.stream_sink)) return false;
    }

    boolean this_present_table_sink = true && this.isSetTable_sink();
    boolean that_present_table_sink = true && that.isSetTable_sink();
    if (this_present_table_sink || that_present_table_sink) {
      if (!(this_present_table_sink && that_present_table_sink)) return false;
      if (!this.table_sink.equals(that.table_sink)) return false;
    }

    return true;
  }
Exemplo n.º 3
0
 /** Performs a deep copy on <i>other</i>. */
 public TDataSink(TDataSink other) {
   if (other.isSetType()) {
     this.type = other.type;
   }
   if (other.isSetStream_sink()) {
     this.stream_sink = new TDataStreamSink(other.stream_sink);
   }
   if (other.isSetTable_sink()) {
     this.table_sink = new TTableSink(other.table_sink);
   }
 }
Exemplo n.º 4
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, TDataSink struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   oprot.writeI32(struct.type.getValue());
   BitSet optionals = new BitSet();
   if (struct.isSetStream_sink()) {
     optionals.set(0);
   }
   if (struct.isSetTable_sink()) {
     optionals.set(1);
   }
   oprot.writeBitSet(optionals, 2);
   if (struct.isSetStream_sink()) {
     struct.stream_sink.write(oprot);
   }
   if (struct.isSetTable_sink()) {
     struct.table_sink.write(oprot);
   }
 }
Exemplo n.º 5
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, TDataSink 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: // TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.type = TDataSinkType.findByValue(iprot.readI32());
              struct.setTypeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // STREAM_SINK
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.stream_sink = new TDataStreamSink();
              struct.stream_sink.read(iprot);
              struct.setStream_sinkIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // TABLE_SINK
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.table_sink = new TTableSink();
              struct.table_sink.read(iprot);
              struct.setTable_sinkIsSet(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();
    }
Exemplo n.º 6
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, TDataSink struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   struct.type = TDataSinkType.findByValue(iprot.readI32());
   struct.setTypeIsSet(true);
   BitSet incoming = iprot.readBitSet(2);
   if (incoming.get(0)) {
     struct.stream_sink = new TDataStreamSink();
     struct.stream_sink.read(iprot);
     struct.setStream_sinkIsSet(true);
   }
   if (incoming.get(1)) {
     struct.table_sink = new TTableSink();
     struct.table_sink.read(iprot);
     struct.setTable_sinkIsSet(true);
   }
 }
Exemplo n.º 7
0
  public int compareTo(TDataSink other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    TDataSink typedOther = (TDataSink) other;

    lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStream_sink()).compareTo(typedOther.isSetStream_sink());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStream_sink()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.stream_sink, typedOther.stream_sink);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetTable_sink()).compareTo(typedOther.isSetTable_sink());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTable_sink()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.table_sink, typedOther.table_sink);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }