All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scray.service.qservice.thriftjava.ScrayTResultFrame Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
/**
 * generated by Scrooge ${project.version}
 */

package scray.service.qservice.thriftjava;

import com.twitter.scrooge.Option;
import com.twitter.scrooge.Utilities;
import com.twitter.scrooge.ThriftStruct;
import com.twitter.scrooge.ThriftStructCodec;
import com.twitter.scrooge.ThriftStructCodec3;
import org.apache.thrift.protocol.*;
import java.nio.ByteBuffer;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;

/**
 * Subset of result rows as transmission units
 */
@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "2017-04-25T16:52:50.412+0200")
public class ScrayTResultFrame implements ThriftStruct {
  private static final TStruct STRUCT = new TStruct("ScrayTResultFrame");
  private static final TField QueryInfoField = new TField("queryInfo", TType.STRUCT, (short) 1);
  final scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo;
  private static final TField RowsField = new TField("rows", TType.LIST, (short) 2);
  final List rows;

  public static class Builder {
    private scray.service.qmodel.thriftjava.ScrayTQueryInfo _queryInfo = null;
    private Boolean _got_queryInfo = false;

    public Builder queryInfo(scray.service.qmodel.thriftjava.ScrayTQueryInfo value) {
      this._queryInfo = value;
      this._got_queryInfo = true;
      return this;
    }

    public Builder unsetQueryInfo() {
      this._queryInfo = null;
      this._got_queryInfo = false;
      return this;
    }
    private List _rows = Utilities.makeList();
    private Boolean _got_rows = false;

    public Builder rows(List value) {
      this._rows = value;
      this._got_rows = true;
      return this;
    }

    public Builder unsetRows() {
      this._rows = Utilities.makeList();
      this._got_rows = false;
      return this;
    }

    public ScrayTResultFrame build() {
      return new ScrayTResultFrame(
        this._queryInfo,
        this._rows    );
    }
  }

  public Builder copy() {
    Builder builder = new Builder();
    builder.queryInfo(this.queryInfo);
    builder.rows(this.rows);
    return builder;
  }

  public static ThriftStructCodec CODEC = new ThriftStructCodec3() {
    @Override
    public ScrayTResultFrame decode(TProtocol _iprot) throws org.apache.thrift.TException {
      Builder builder = new Builder();
      scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo = null;
      List rows = Utilities.makeList();
      Boolean _done = false;
      _iprot.readStructBegin();
      while (!_done) {
        TField _field = _iprot.readFieldBegin();
        if (_field.type == TType.STOP) {
          _done = true;
        } else {
          switch (_field.id) {
            case 1: /* queryInfo */
              switch (_field.type) {
                case TType.STRUCT:
                  scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo_item;
                  queryInfo_item = scray.service.qmodel.thriftjava.ScrayTQueryInfo.decode(_iprot);
                  queryInfo = queryInfo_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.queryInfo(queryInfo);
              break;
            case 2: /* rows */
              switch (_field.type) {
                case TType.LIST:
                  List rows_item;
                  TList _list_rows_item = _iprot.readListBegin();
                  rows_item = new ArrayList();
                  int _i_rows_item = 0;
                  scray.service.qmodel.thriftjava.ScrayTRow rows_item_element;
                  while (_i_rows_item < _list_rows_item.size) {
                    rows_item_element = scray.service.qmodel.thriftjava.ScrayTRow.decode(_iprot);
                    rows_item.add(rows_item_element);
                    _i_rows_item += 1;
                  }
                  _iprot.readListEnd();
                  rows = rows_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.rows(rows);
              break;
            default:
              TProtocolUtil.skip(_iprot, _field.type);
          }
          _iprot.readFieldEnd();
        }
      }
      _iprot.readStructEnd();
      try {
        return builder.build();
      } catch (IllegalStateException stateEx) {
        throw new TProtocolException(stateEx.getMessage());
      }
    }

    @Override
    public void encode(ScrayTResultFrame struct, TProtocol oprot) throws org.apache.thrift.TException {
      struct.write(oprot);
    }
  };

  public static ScrayTResultFrame decode(TProtocol _iprot) throws org.apache.thrift.TException {
    return CODEC.decode(_iprot);
  }

  public static void encode(ScrayTResultFrame struct, TProtocol oprot) throws org.apache.thrift.TException {
    CODEC.encode(struct, oprot);
  }

  public ScrayTResultFrame(
    scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo, 
    List rows
  ) {
    this.queryInfo = queryInfo;
    this.rows = rows;
  }


  public scray.service.qmodel.thriftjava.ScrayTQueryInfo getQueryInfo() {
    return this.queryInfo;
  }
  public boolean isSetQueryInfo() {
    return this.queryInfo != null;
  }
  public List getRows() {
    return this.rows;
  }
  public boolean isSetRows() {
    return this.rows != null;
  }

  public void write(TProtocol _oprot) throws org.apache.thrift.TException {
    validate();
    _oprot.writeStructBegin(STRUCT);
      _oprot.writeFieldBegin(QueryInfoField);
      scray.service.qmodel.thriftjava.ScrayTQueryInfo queryInfo_item = queryInfo;
      queryInfo_item.write(_oprot);
      _oprot.writeFieldEnd();
      _oprot.writeFieldBegin(RowsField);
      List rows_item = rows;
      _oprot.writeListBegin(new TList(TType.STRUCT, rows_item.size()));
      for (scray.service.qmodel.thriftjava.ScrayTRow rows_item_element : rows_item) {
        rows_item_element.write(_oprot);
      }
      _oprot.writeListEnd();
      _oprot.writeFieldEnd();
    _oprot.writeFieldStop();
    _oprot.writeStructEnd();
  }

  private void validate() throws org.apache.thrift.protocol.TProtocolException {
  }


  @Override
  public boolean equals(Object other) {
    if (!(other instanceof ScrayTResultFrame)) return false;
    ScrayTResultFrame that = (ScrayTResultFrame) other;
    return
this.queryInfo.equals(that.queryInfo) &&
this.rows.equals(that.rows);
  }

  @Override
  public String toString() {
    return "ScrayTResultFrame(" + this.queryInfo + "," + this.rows + ")";
  }

  @Override
  public int hashCode() {
    int hash = 1;
    hash = hash * (this.queryInfo == null ? 0 : this.queryInfo.hashCode());
    hash = hash * (this.rows == null ? 0 : this.rows.hashCode());
    return hash;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy