scray.service.qmodel.thriftjava.ScrayUUID Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scray-client-jdbc Show documentation
Show all versions of scray-client-jdbc Show documentation
scray java code, which can be used from java and scala
The newest version!
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package scray.service.qmodel.thriftjava;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.thrift.*;
import org.apache.thrift.async.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.protocol.*;
// No additional import required for struct/union.
public class ScrayUUID implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("ScrayUUID");
private static final TField MOST_SIG_BITS_FIELD_DESC = new TField("mostSigBits", TType.I64, (short)1);
private static final TField LEAST_SIG_BITS_FIELD_DESC = new TField("leastSigBits", TType.I64, (short)2);
public long mostSigBits;
public long leastSigBits;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
MOST_SIG_BITS((short)1, "mostSigBits"),
LEAST_SIG_BITS((short)2, "leastSigBits");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // MOST_SIG_BITS
return MOST_SIG_BITS;
case 2: // LEAST_SIG_BITS
return LEAST_SIG_BITS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __MOSTSIGBITS_ISSET_ID = 0;
private static final int __LEASTSIGBITS_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.MOST_SIG_BITS, new FieldMetaData("mostSigBits", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
tmpMap.put(_Fields.LEAST_SIG_BITS, new FieldMetaData("leastSigBits", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(ScrayUUID.class, metaDataMap);
}
public ScrayUUID() {
}
public ScrayUUID(
long mostSigBits,
long leastSigBits)
{
this();
this.mostSigBits = mostSigBits;
setMostSigBitsIsSet(true);
this.leastSigBits = leastSigBits;
setLeastSigBitsIsSet(true);
}
/**
* Performs a deep copy on other.
*/
public ScrayUUID(ScrayUUID other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
this.mostSigBits = other.mostSigBits;
this.leastSigBits = other.leastSigBits;
}
public ScrayUUID deepCopy() {
return new ScrayUUID(this);
}
@java.lang.Override
public void clear() {
setMostSigBitsIsSet(false);
this.mostSigBits = 0;
setLeastSigBitsIsSet(false);
this.leastSigBits = 0;
}
public long getMostSigBits() {
return this.mostSigBits;
}
public ScrayUUID setMostSigBits(long mostSigBits) {
this.mostSigBits = mostSigBits;
setMostSigBitsIsSet(true);
return this;
}
public void unsetMostSigBits() {
__isset_bit_vector.clear(__MOSTSIGBITS_ISSET_ID);
}
/** Returns true if field mostSigBits is set (has been asigned a value) and false otherwise */
public boolean isSetMostSigBits() {
return __isset_bit_vector.get(__MOSTSIGBITS_ISSET_ID);
}
public void setMostSigBitsIsSet(boolean value) {
__isset_bit_vector.set(__MOSTSIGBITS_ISSET_ID, value);
}
public long getLeastSigBits() {
return this.leastSigBits;
}
public ScrayUUID setLeastSigBits(long leastSigBits) {
this.leastSigBits = leastSigBits;
setLeastSigBitsIsSet(true);
return this;
}
public void unsetLeastSigBits() {
__isset_bit_vector.clear(__LEASTSIGBITS_ISSET_ID);
}
/** Returns true if field leastSigBits is set (has been asigned a value) and false otherwise */
public boolean isSetLeastSigBits() {
return __isset_bit_vector.get(__LEASTSIGBITS_ISSET_ID);
}
public void setLeastSigBitsIsSet(boolean value) {
__isset_bit_vector.set(__LEASTSIGBITS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case MOST_SIG_BITS:
if (value == null) {
unsetMostSigBits();
} else {
setMostSigBits((Long)value);
}
break;
case LEAST_SIG_BITS:
if (value == null) {
unsetLeastSigBits();
} else {
setLeastSigBits((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case MOST_SIG_BITS:
return new Long(getMostSigBits());
case LEAST_SIG_BITS:
return new Long(getLeastSigBits());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case MOST_SIG_BITS:
return isSetMostSigBits();
case LEAST_SIG_BITS:
return isSetLeastSigBits();
}
throw new IllegalStateException();
}
@java.lang.Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ScrayUUID)
return this.equals((ScrayUUID)that);
return false;
}
public boolean equals(ScrayUUID that) {
if (that == null)
return false;
boolean this_present_mostSigBits = true;
boolean that_present_mostSigBits = true;
if (this_present_mostSigBits || that_present_mostSigBits) {
if (!(this_present_mostSigBits && that_present_mostSigBits))
return false;
if (this.mostSigBits != that.mostSigBits)
return false;
}
boolean this_present_leastSigBits = true;
boolean that_present_leastSigBits = true;
if (this_present_leastSigBits || that_present_leastSigBits) {
if (!(this_present_leastSigBits && that_present_leastSigBits))
return false;
if (this.leastSigBits != that.leastSigBits)
return false;
}
return true;
}
@java.lang.Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_mostSigBits = true;
builder.append(present_mostSigBits);
if (present_mostSigBits)
builder.append(mostSigBits);
boolean present_leastSigBits = true;
builder.append(present_leastSigBits);
if (present_leastSigBits)
builder.append(leastSigBits);
return builder.toHashCode();
}
public int compareTo(ScrayUUID other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
ScrayUUID typedOther = (ScrayUUID)other;
lastComparison = Boolean.valueOf(isSetMostSigBits()).compareTo(typedOther.isSetMostSigBits());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMostSigBits()) {
lastComparison = TBaseHelper.compareTo(this.mostSigBits, typedOther.mostSigBits);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetLeastSigBits()).compareTo(typedOther.isSetLeastSigBits());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLeastSigBits()) {
lastComparison = TBaseHelper.compareTo(this.leastSigBits, typedOther.leastSigBits);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == TType.STOP) {
break;
}
switch (field.id) {
case 1: // MOST_SIG_BITS
if (field.type == TType.I64) {
this.mostSigBits = iprot.readI64();
setMostSigBitsIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // LEAST_SIG_BITS
if (field.type == TType.I64) {
this.leastSigBits = iprot.readI64();
setLeastSigBitsIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(MOST_SIG_BITS_FIELD_DESC);
oprot.writeI64(this.mostSigBits);
oprot.writeFieldEnd();
oprot.writeFieldBegin(LEAST_SIG_BITS_FIELD_DESC);
oprot.writeI64(this.leastSigBits);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@java.lang.Override
public String toString() {
StringBuilder sb = new StringBuilder("ScrayUUID(");
boolean first = true;
sb.append("mostSigBits:");
sb.append(this.mostSigBits);
first = false;
if (!first) sb.append(", ");
sb.append("leastSigBits:");
sb.append(this.leastSigBits);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}