All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.twitter.flockdb.thrift.Page Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (0.8.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.twitter.flockdb.thrift;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
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;
public class Page implements org.apache.thrift.TBase, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Page");
private static final org.apache.thrift.protocol.TField COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("count", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField CURSOR_FIELD_DESC = new org.apache.thrift.protocol.TField("cursor", org.apache.thrift.protocol.TType.I64, (short)2);
private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new PageStandardSchemeFactory());
schemes.put(TupleScheme.class, new PageTupleSchemeFactory());
}
public int count; // required
public long cursor; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COUNT((short)1, "count"),
CURSOR((short)2, "cursor");
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: // COUNT
return COUNT;
case 2: // CURSOR
return CURSOR;
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 __COUNT_ISSET_ID = 0;
private static final int __CURSOR_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COUNT, new org.apache.thrift.meta_data.FieldMetaData("count", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.CURSOR, new org.apache.thrift.meta_data.FieldMetaData("cursor", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Page.class, metaDataMap);
}
public Page() {
}
public Page(
int count,
long cursor)
{
this();
this.count = count;
setCountIsSet(true);
this.cursor = cursor;
setCursorIsSet(true);
}
/**
* Performs a deep copy on other .
*/
public Page(Page other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
this.count = other.count;
this.cursor = other.cursor;
}
public Page deepCopy() {
return new Page(this);
}
@Override
public void clear() {
setCountIsSet(false);
this.count = 0;
setCursorIsSet(false);
this.cursor = 0;
}
public int getCount() {
return this.count;
}
public Page setCount(int count) {
this.count = count;
setCountIsSet(true);
return this;
}
public void unsetCount() {
__isset_bit_vector.clear(__COUNT_ISSET_ID);
}
/** Returns true if field count is set (has been assigned a value) and false otherwise */
public boolean isSetCount() {
return __isset_bit_vector.get(__COUNT_ISSET_ID);
}
public void setCountIsSet(boolean value) {
__isset_bit_vector.set(__COUNT_ISSET_ID, value);
}
public long getCursor() {
return this.cursor;
}
public Page setCursor(long cursor) {
this.cursor = cursor;
setCursorIsSet(true);
return this;
}
public void unsetCursor() {
__isset_bit_vector.clear(__CURSOR_ISSET_ID);
}
/** Returns true if field cursor is set (has been assigned a value) and false otherwise */
public boolean isSetCursor() {
return __isset_bit_vector.get(__CURSOR_ISSET_ID);
}
public void setCursorIsSet(boolean value) {
__isset_bit_vector.set(__CURSOR_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Integer)value);
}
break;
case CURSOR:
if (value == null) {
unsetCursor();
} else {
setCursor((Long)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COUNT:
return Integer.valueOf(getCount());
case CURSOR:
return Long.valueOf(getCursor());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COUNT:
return isSetCount();
case CURSOR:
return isSetCursor();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof Page)
return this.equals((Page)that);
return false;
}
public boolean equals(Page that) {
if (that == null)
return false;
boolean this_present_count = true;
boolean that_present_count = true;
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}
boolean this_present_cursor = true;
boolean that_present_cursor = true;
if (this_present_cursor || that_present_cursor) {
if (!(this_present_cursor && that_present_cursor))
return false;
if (this.cursor != that.cursor)
return false;
}
return true;
}
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
boolean present_count = true;
builder.append(present_count);
if (present_count)
builder.append(count);
boolean present_cursor = true;
builder.append(present_cursor);
if (present_cursor)
builder.append(cursor);
return builder.toHashCode();
}
public int compareTo(Page other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
Page typedOther = (Page)other;
lastComparison = Boolean.valueOf(isSetCount()).compareTo(typedOther.isSetCount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.count, typedOther.count);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCursor()).compareTo(typedOther.isSetCursor());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCursor()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cursor, typedOther.cursor);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Page(");
boolean first = true;
sb.append("count:");
sb.append(this.count);
first = false;
if (!first) sb.append(", ");
sb.append("cursor:");
sb.append(this.cursor);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class PageStandardSchemeFactory implements SchemeFactory {
public PageStandardScheme getScheme() {
return new PageStandardScheme();
}
}
private static class PageStandardScheme extends StandardScheme {
public void read(org.apache.thrift.protocol.TProtocol iprot, Page struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.count = iprot.readI32();
struct.setCountIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // CURSOR
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.cursor = iprot.readI64();
struct.setCursorIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, Page struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI32(struct.count);
oprot.writeFieldEnd();
oprot.writeFieldBegin(CURSOR_FIELD_DESC);
oprot.writeI64(struct.cursor);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class PageTupleSchemeFactory implements SchemeFactory {
public PageTupleScheme getScheme() {
return new PageTupleScheme();
}
}
private static class PageTupleScheme extends TupleScheme {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, Page struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetCount()) {
optionals.set(0);
}
if (struct.isSetCursor()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetCount()) {
oprot.writeI32(struct.count);
}
if (struct.isSetCursor()) {
oprot.writeI64(struct.cursor);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, Page struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.count = iprot.readI32();
struct.setCountIsSet(true);
}
if (incoming.get(1)) {
struct.cursor = iprot.readI64();
struct.setCursorIsSet(true);
}
}
}
}