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

scray.service.qmodel.thriftjava.ScrayTColumn 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 ScrayTColumn implements ThriftStruct {
  private static final TStruct STRUCT = new TStruct("ScrayTColumn");
  private static final TField ColumnInfoField = new TField("columnInfo", TType.STRUCT, (short) 1);
  final ScrayTColumnInfo columnInfo;
  private static final TField ValueField = new TField("value", TType.STRING, (short) 2);
  final ByteBuffer value;

  public static class Builder {
    private ScrayTColumnInfo _columnInfo = null;
    private Boolean _got_columnInfo = false;

    public Builder columnInfo(ScrayTColumnInfo value) {
      this._columnInfo = value;
      this._got_columnInfo = true;
      return this;
    }

    public Builder unsetColumnInfo() {
      this._columnInfo = null;
      this._got_columnInfo = false;
      return this;
    }
    private ByteBuffer _value = null;
    private Boolean _got_value = false;

    public Builder value(ByteBuffer value) {
      this._value = value;
      this._got_value = true;
      return this;
    }

    public Builder unsetValue() {
      this._value = null;
      this._got_value = false;
      return this;
    }

    public ScrayTColumn build() {
      return new ScrayTColumn(
        this._columnInfo,
        this._value    );
    }
  }

  public Builder copy() {
    Builder builder = new Builder();
    builder.columnInfo(this.columnInfo);
    builder.value(this.value);
    return builder;
  }

  public static ThriftStructCodec CODEC = new ThriftStructCodec3() {
    @Override
    public ScrayTColumn decode(TProtocol _iprot) throws org.apache.thrift.TException {
      Builder builder = new Builder();
      ScrayTColumnInfo columnInfo = null;
      ByteBuffer value = null;
      Boolean _done = false;
      _iprot.readStructBegin();
      while (!_done) {
        TField _field = _iprot.readFieldBegin();
        if (_field.type == TType.STOP) {
          _done = true;
        } else {
          switch (_field.id) {
            case 1: /* columnInfo */
              switch (_field.type) {
                case TType.STRUCT:
                  ScrayTColumnInfo columnInfo_item;
                  columnInfo_item = ScrayTColumnInfo.decode(_iprot);
                  columnInfo = columnInfo_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.columnInfo(columnInfo);
              break;
            case 2: /* value */
              switch (_field.type) {
                case TType.STRING:
                  ByteBuffer value_item;
                  value_item = _iprot.readBinary();
                  value = value_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.value(value);
              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(ScrayTColumn struct, TProtocol oprot) throws org.apache.thrift.TException {
      struct.write(oprot);
    }
  };

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

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

  public ScrayTColumn(
    ScrayTColumnInfo columnInfo, 
    ByteBuffer value
  ) {
    this.columnInfo = columnInfo;
    this.value = value;
  }


  public ScrayTColumnInfo getColumnInfo() {
    return this.columnInfo;
  }
  public boolean isSetColumnInfo() {
    return this.columnInfo != null;
  }
  public ByteBuffer getValue() {
    return this.value;
  }
  public boolean isSetValue() {
    return this.value != null;
  }

  public void write(TProtocol _oprot) throws org.apache.thrift.TException {
    validate();
    _oprot.writeStructBegin(STRUCT);
      _oprot.writeFieldBegin(ColumnInfoField);
      ScrayTColumnInfo columnInfo_item = columnInfo;
      columnInfo_item.write(_oprot);
      _oprot.writeFieldEnd();
      _oprot.writeFieldBegin(ValueField);
      ByteBuffer value_item = value;
      _oprot.writeBinary(value_item);
      _oprot.writeFieldEnd();
    _oprot.writeFieldStop();
    _oprot.writeStructEnd();
  }

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


  @Override
  public boolean equals(Object other) {
    if (!(other instanceof ScrayTColumn)) return false;
    ScrayTColumn that = (ScrayTColumn) other;
    return
this.columnInfo.equals(that.columnInfo) &&
this.value.equals(that.value);
  }

  @Override
  public String toString() {
    return "ScrayTColumn(" + this.columnInfo + "," + this.value + ")";
  }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy