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

scray.service.qmodel.thriftjava.ScrayTRow Maven / Gradle / Ivy

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

package scray.service.qmodel.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;


@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "2017-04-25T16:52:50.412+0200")
public class ScrayTRow implements ThriftStruct {
  private static final TStruct STRUCT = new TStruct("ScrayTRow");
  private static final TField RowIdField = new TField("rowId", TType.STRING, (short) 1);
  final Option rowId;
  private static final TField ColumnsField = new TField("columns", TType.LIST, (short) 2);
  final Option> columns;

  public static class Builder {
    private ByteBuffer _rowId = null;
    private Boolean _got_rowId = false;

    public Builder rowId(ByteBuffer value) {
      this._rowId = value;
      this._got_rowId = true;
      return this;
    }

    public Builder unsetRowId() {
      this._rowId = null;
      this._got_rowId = false;
      return this;
    }
    private List _columns = Utilities.makeList();
    private Boolean _got_columns = false;

    public Builder columns(List value) {
      this._columns = value;
      this._got_columns = true;
      return this;
    }

    public Builder unsetColumns() {
      this._columns = Utilities.makeList();
      this._got_columns = false;
      return this;
    }

    public ScrayTRow build() {
      return new ScrayTRow(
      Option.make(this._got_rowId, this._rowId),
      Option.make(this._got_columns, this._columns)    );
    }
  }

  public Builder copy() {
    Builder builder = new Builder();
    if (this.rowId.isDefined()) builder.rowId(this.rowId.get());
    if (this.columns.isDefined()) builder.columns(this.columns.get());
    return builder;
  }

  public static ThriftStructCodec CODEC = new ThriftStructCodec3() {
    @Override
    public ScrayTRow decode(TProtocol _iprot) throws org.apache.thrift.TException {
      Builder builder = new Builder();
      ByteBuffer rowId = null;
      List columns = 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: /* rowId */
              switch (_field.type) {
                case TType.STRING:
                  ByteBuffer rowId_item;
                  rowId_item = _iprot.readBinary();
                  rowId = rowId_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.rowId(rowId);
              break;
            case 2: /* columns */
              switch (_field.type) {
                case TType.LIST:
                  List columns_item;
                  TList _list_columns_item = _iprot.readListBegin();
                  columns_item = new ArrayList();
                  int _i_columns_item = 0;
                  ScrayTColumn columns_item_element;
                  while (_i_columns_item < _list_columns_item.size) {
                    columns_item_element = ScrayTColumn.decode(_iprot);
                    columns_item.add(columns_item_element);
                    _i_columns_item += 1;
                  }
                  _iprot.readListEnd();
                  columns = columns_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.columns(columns);
              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(ScrayTRow struct, TProtocol oprot) throws org.apache.thrift.TException {
      struct.write(oprot);
    }
  };

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

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

  public ScrayTRow(
    Option rowId, 
    Option> columns
  ) {
    this.rowId = rowId;
    this.columns = columns;
  }


  public ByteBuffer getRowId() {
    return this.rowId.get();
  }
  public boolean isSetRowId() {
    return this.rowId.isDefined();
  }
  public List getColumns() {
    return this.columns.get();
  }
  public boolean isSetColumns() {
    return this.columns.isDefined();
  }

  public void write(TProtocol _oprot) throws org.apache.thrift.TException {
    validate();
    _oprot.writeStructBegin(STRUCT);
    if (rowId.isDefined()) {  _oprot.writeFieldBegin(RowIdField);
      ByteBuffer rowId_item = rowId.get();
      _oprot.writeBinary(rowId_item);
      _oprot.writeFieldEnd();
    }
    if (columns.isDefined()) {  _oprot.writeFieldBegin(ColumnsField);
      List columns_item = columns.get();
      _oprot.writeListBegin(new TList(TType.STRUCT, columns_item.size()));
      for (ScrayTColumn columns_item_element : columns_item) {
        columns_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 ScrayTRow)) return false;
    ScrayTRow that = (ScrayTRow) other;
    return
this.rowId.equals(that.rowId) &&
this.columns.equals(that.columns);
  }

  @Override
  public String toString() {
    return "ScrayTRow(" + this.rowId + "," + this.columns + ")";
  }

  @Override
  public int hashCode() {
    int hash = 1;
    hash = hash * (this.rowId.isDefined() ? 0 : this.rowId.get().hashCode());
    hash = hash * (this.columns.isDefined() ? 0 : this.columns.get().hashCode());
    return hash;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy