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

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

/**
 * Identifier
 */
@javax.annotation.Generated(value = "com.twitter.scrooge.Compiler", date = "2017-04-25T16:52:50.412+0200")
public class ScrayUUID implements ThriftStruct {
  private static final TStruct STRUCT = new TStruct("ScrayUUID");
  private static final TField MostSigBitsField = new TField("mostSigBits", TType.I64, (short) 1);
  final long mostSigBits;
  private static final TField LeastSigBitsField = new TField("leastSigBits", TType.I64, (short) 2);
  final long leastSigBits;

  public static class Builder {
    private long _mostSigBits = 0L;
    private Boolean _got_mostSigBits = false;

    public Builder mostSigBits(long value) {
      this._mostSigBits = value;
      this._got_mostSigBits = true;
      return this;
    }

    public Builder unsetMostSigBits() {
      this._mostSigBits = 0L;
      this._got_mostSigBits = false;
      return this;
    }
    private long _leastSigBits = 0L;
    private Boolean _got_leastSigBits = false;

    public Builder leastSigBits(long value) {
      this._leastSigBits = value;
      this._got_leastSigBits = true;
      return this;
    }

    public Builder unsetLeastSigBits() {
      this._leastSigBits = 0L;
      this._got_leastSigBits = false;
      return this;
    }

    public ScrayUUID build() {
      return new ScrayUUID(
        this._mostSigBits,
        this._leastSigBits    );
    }
  }

  public Builder copy() {
    Builder builder = new Builder();
    builder.mostSigBits(this.mostSigBits);
    builder.leastSigBits(this.leastSigBits);
    return builder;
  }

  public static ThriftStructCodec CODEC = new ThriftStructCodec3() {
    @Override
    public ScrayUUID decode(TProtocol _iprot) throws org.apache.thrift.TException {
      Builder builder = new Builder();
      long mostSigBits = 0L;
      long leastSigBits = 0L;
      Boolean _done = false;
      _iprot.readStructBegin();
      while (!_done) {
        TField _field = _iprot.readFieldBegin();
        if (_field.type == TType.STOP) {
          _done = true;
        } else {
          switch (_field.id) {
            case 1: /* mostSigBits */
              switch (_field.type) {
                case TType.I64:
                  Long mostSigBits_item;
                  mostSigBits_item = _iprot.readI64();
                  mostSigBits = mostSigBits_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.mostSigBits(mostSigBits);
              break;
            case 2: /* leastSigBits */
              switch (_field.type) {
                case TType.I64:
                  Long leastSigBits_item;
                  leastSigBits_item = _iprot.readI64();
                  leastSigBits = leastSigBits_item;
                  break;
                default:
                  TProtocolUtil.skip(_iprot, _field.type);
              }
              builder.leastSigBits(leastSigBits);
              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(ScrayUUID struct, TProtocol oprot) throws org.apache.thrift.TException {
      struct.write(oprot);
    }
  };

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

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

  public ScrayUUID(
    long mostSigBits, 
    long leastSigBits
  ) {
    this.mostSigBits = mostSigBits;
    this.leastSigBits = leastSigBits;
  }


  public long getMostSigBits() {
    return this.mostSigBits;
  }
  public long getLeastSigBits() {
    return this.leastSigBits;
  }

  public void write(TProtocol _oprot) throws org.apache.thrift.TException {
    validate();
    _oprot.writeStructBegin(STRUCT);
      _oprot.writeFieldBegin(MostSigBitsField);
      Long mostSigBits_item = mostSigBits;
      _oprot.writeI64(mostSigBits_item);
      _oprot.writeFieldEnd();
      _oprot.writeFieldBegin(LeastSigBitsField);
      Long leastSigBits_item = leastSigBits;
      _oprot.writeI64(leastSigBits_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 ScrayUUID)) return false;
    ScrayUUID that = (ScrayUUID) other;
    return
      this.mostSigBits == that.mostSigBits &&

      this.leastSigBits == that.leastSigBits
;
  }

  @Override
  public String toString() {
    return "ScrayUUID(" + this.mostSigBits + "," + this.leastSigBits + ")";
  }

  @Override
  public int hashCode() {
    int hash = 1;
    hash = hash * new Long(this.mostSigBits).hashCode();
    hash = hash * new Long(this.leastSigBits).hashCode();
    return hash;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy