ezbake.data.mongo.driver.thrift.EzFindRequest.java Source code

Java tutorial

Introduction

Here is the source code for ezbake.data.mongo.driver.thrift.EzFindRequest.java

Source

/*   Copyright (C) 2013-2014 Computer Sciences Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. */

/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package ezbake.data.mongo.driver.thrift;

import org.apache.commons.lang3.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 org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
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 EzFindRequest implements org.apache.thrift.TBase<EzFindRequest, EzFindRequest._Fields>,
        java.io.Serializable, Cloneable, Comparable<EzFindRequest> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
            "EzFindRequest");

    private static final org.apache.thrift.protocol.TField REF_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "ref", org.apache.thrift.protocol.TType.STRING, (short) 1);
    private static final org.apache.thrift.protocol.TField FIELDS_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "fields", org.apache.thrift.protocol.TType.STRING, (short) 2);
    private static final org.apache.thrift.protocol.TField NUM_TO_SKIP_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "numToSkip", org.apache.thrift.protocol.TType.I32, (short) 3);
    private static final org.apache.thrift.protocol.TField BATCH_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "batchSize", org.apache.thrift.protocol.TType.I32, (short) 4);
    private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "limit", org.apache.thrift.protocol.TType.I32, (short) 5);
    private static final org.apache.thrift.protocol.TField OPTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "options", org.apache.thrift.protocol.TType.I32, (short) 6);
    private static final org.apache.thrift.protocol.TField READ_PREF_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "readPref", org.apache.thrift.protocol.TType.STRING, (short) 7);
    private static final org.apache.thrift.protocol.TField DECODER_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "decoder", org.apache.thrift.protocol.TType.STRING, (short) 8);
    private static final org.apache.thrift.protocol.TField ENCODER_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "encoder", org.apache.thrift.protocol.TType.STRING, (short) 9);
    private static final org.apache.thrift.protocol.TField COLLECTION_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "collection", org.apache.thrift.protocol.TType.STRING, (short) 10);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
        schemes.put(StandardScheme.class, new EzFindRequestStandardSchemeFactory());
        schemes.put(TupleScheme.class, new EzFindRequestTupleSchemeFactory());
    }

    public ByteBuffer ref; // required
    public ByteBuffer fields; // required
    public int numToSkip; // required
    public int batchSize; // required
    public int limit; // required
    public int options; // required
    public ByteBuffer readPref; // required
    public ByteBuffer decoder; // required
    public ByteBuffer encoder; // required
    public String collection; // 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 {
        REF((short) 1, "ref"), FIELDS((short) 2, "fields"), NUM_TO_SKIP((short) 3, "numToSkip"), BATCH_SIZE(
                (short) 4, "batchSize"), LIMIT((short) 5, "limit"), OPTIONS((short) 6,
                        "options"), READ_PREF((short) 7, "readPref"), DECODER((short) 8,
                                "decoder"), ENCODER((short) 9, "encoder"), COLLECTION((short) 10, "collection");

        private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

        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: // REF
                return REF;
            case 2: // FIELDS
                return FIELDS;
            case 3: // NUM_TO_SKIP
                return NUM_TO_SKIP;
            case 4: // BATCH_SIZE
                return BATCH_SIZE;
            case 5: // LIMIT
                return LIMIT;
            case 6: // OPTIONS
                return OPTIONS;
            case 7: // READ_PREF
                return READ_PREF;
            case 8: // DECODER
                return DECODER;
            case 9: // ENCODER
                return ENCODER;
            case 10: // COLLECTION
                return COLLECTION;
            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 __NUMTOSKIP_ISSET_ID = 0;
    private static final int __BATCHSIZE_ISSET_ID = 1;
    private static final int __LIMIT_ISSET_ID = 2;
    private static final int __OPTIONS_ISSET_ID = 3;
    private byte __isset_bitfield = 0;
    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.REF, new org.apache.thrift.meta_data.FieldMetaData("ref",
                org.apache.thrift.TFieldRequirementType.DEFAULT,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
        tmpMap.put(_Fields.FIELDS, new org.apache.thrift.meta_data.FieldMetaData("fields",
                org.apache.thrift.TFieldRequirementType.DEFAULT,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
        tmpMap.put(_Fields.NUM_TO_SKIP,
                new org.apache.thrift.meta_data.FieldMetaData("numToSkip",
                        org.apache.thrift.TFieldRequirementType.DEFAULT,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.BATCH_SIZE,
                new org.apache.thrift.meta_data.FieldMetaData("batchSize",
                        org.apache.thrift.TFieldRequirementType.DEFAULT,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.LIMIT,
                new org.apache.thrift.meta_data.FieldMetaData("limit",
                        org.apache.thrift.TFieldRequirementType.DEFAULT,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.OPTIONS,
                new org.apache.thrift.meta_data.FieldMetaData("options",
                        org.apache.thrift.TFieldRequirementType.DEFAULT,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.READ_PREF, new org.apache.thrift.meta_data.FieldMetaData("readPref",
                org.apache.thrift.TFieldRequirementType.DEFAULT,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
        tmpMap.put(_Fields.DECODER, new org.apache.thrift.meta_data.FieldMetaData("decoder",
                org.apache.thrift.TFieldRequirementType.DEFAULT,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
        tmpMap.put(_Fields.ENCODER, new org.apache.thrift.meta_data.FieldMetaData("encoder",
                org.apache.thrift.TFieldRequirementType.DEFAULT,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING, true)));
        tmpMap.put(_Fields.COLLECTION, new org.apache.thrift.meta_data.FieldMetaData("collection",
                org.apache.thrift.TFieldRequirementType.DEFAULT,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        metaDataMap = Collections.unmodifiableMap(tmpMap);
        org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(EzFindRequest.class, metaDataMap);
    }

    public EzFindRequest() {
    }

    public EzFindRequest(ByteBuffer ref, ByteBuffer fields, int numToSkip, int batchSize, int limit, int options,
            ByteBuffer readPref, ByteBuffer decoder, ByteBuffer encoder, String collection) {
        this();
        this.ref = ref;
        this.fields = fields;
        this.numToSkip = numToSkip;
        setNumToSkipIsSet(true);
        this.batchSize = batchSize;
        setBatchSizeIsSet(true);
        this.limit = limit;
        setLimitIsSet(true);
        this.options = options;
        setOptionsIsSet(true);
        this.readPref = readPref;
        this.decoder = decoder;
        this.encoder = encoder;
        this.collection = collection;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public EzFindRequest(EzFindRequest other) {
        __isset_bitfield = other.__isset_bitfield;
        if (other.isSetRef()) {
            this.ref = org.apache.thrift.TBaseHelper.copyBinary(other.ref);
            ;
        }
        if (other.isSetFields()) {
            this.fields = org.apache.thrift.TBaseHelper.copyBinary(other.fields);
            ;
        }
        this.numToSkip = other.numToSkip;
        this.batchSize = other.batchSize;
        this.limit = other.limit;
        this.options = other.options;
        if (other.isSetReadPref()) {
            this.readPref = org.apache.thrift.TBaseHelper.copyBinary(other.readPref);
            ;
        }
        if (other.isSetDecoder()) {
            this.decoder = org.apache.thrift.TBaseHelper.copyBinary(other.decoder);
            ;
        }
        if (other.isSetEncoder()) {
            this.encoder = org.apache.thrift.TBaseHelper.copyBinary(other.encoder);
            ;
        }
        if (other.isSetCollection()) {
            this.collection = other.collection;
        }
    }

    public EzFindRequest deepCopy() {
        return new EzFindRequest(this);
    }

    @Override
    public void clear() {
        this.ref = null;
        this.fields = null;
        setNumToSkipIsSet(false);
        this.numToSkip = 0;
        setBatchSizeIsSet(false);
        this.batchSize = 0;
        setLimitIsSet(false);
        this.limit = 0;
        setOptionsIsSet(false);
        this.options = 0;
        this.readPref = null;
        this.decoder = null;
        this.encoder = null;
        this.collection = null;
    }

    public byte[] getRef() {
        setRef(org.apache.thrift.TBaseHelper.rightSize(ref));
        return ref == null ? null : ref.array();
    }

    public ByteBuffer bufferForRef() {
        return ref;
    }

    public EzFindRequest setRef(byte[] ref) {
        setRef(ref == null ? (ByteBuffer) null : ByteBuffer.wrap(ref));
        return this;
    }

    public EzFindRequest setRef(ByteBuffer ref) {
        this.ref = ref;
        return this;
    }

    public void unsetRef() {
        this.ref = null;
    }

    /** Returns true if field ref is set (has been assigned a value) and false otherwise */
    public boolean isSetRef() {
        return this.ref != null;
    }

    public void setRefIsSet(boolean value) {
        if (!value) {
            this.ref = null;
        }
    }

    public byte[] getFields() {
        setFields(org.apache.thrift.TBaseHelper.rightSize(fields));
        return fields == null ? null : fields.array();
    }

    public ByteBuffer bufferForFields() {
        return fields;
    }

    public EzFindRequest setFields(byte[] fields) {
        setFields(fields == null ? (ByteBuffer) null : ByteBuffer.wrap(fields));
        return this;
    }

    public EzFindRequest setFields(ByteBuffer fields) {
        this.fields = fields;
        return this;
    }

    public void unsetFields() {
        this.fields = null;
    }

    /** Returns true if field fields is set (has been assigned a value) and false otherwise */
    public boolean isSetFields() {
        return this.fields != null;
    }

    public void setFieldsIsSet(boolean value) {
        if (!value) {
            this.fields = null;
        }
    }

    public int getNumToSkip() {
        return this.numToSkip;
    }

    public EzFindRequest setNumToSkip(int numToSkip) {
        this.numToSkip = numToSkip;
        setNumToSkipIsSet(true);
        return this;
    }

    public void unsetNumToSkip() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NUMTOSKIP_ISSET_ID);
    }

    /** Returns true if field numToSkip is set (has been assigned a value) and false otherwise */
    public boolean isSetNumToSkip() {
        return EncodingUtils.testBit(__isset_bitfield, __NUMTOSKIP_ISSET_ID);
    }

    public void setNumToSkipIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NUMTOSKIP_ISSET_ID, value);
    }

    public int getBatchSize() {
        return this.batchSize;
    }

    public EzFindRequest setBatchSize(int batchSize) {
        this.batchSize = batchSize;
        setBatchSizeIsSet(true);
        return this;
    }

    public void unsetBatchSize() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BATCHSIZE_ISSET_ID);
    }

    /** Returns true if field batchSize is set (has been assigned a value) and false otherwise */
    public boolean isSetBatchSize() {
        return EncodingUtils.testBit(__isset_bitfield, __BATCHSIZE_ISSET_ID);
    }

    public void setBatchSizeIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BATCHSIZE_ISSET_ID, value);
    }

    public int getLimit() {
        return this.limit;
    }

    public EzFindRequest setLimit(int limit) {
        this.limit = limit;
        setLimitIsSet(true);
        return this;
    }

    public void unsetLimit() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LIMIT_ISSET_ID);
    }

    /** Returns true if field limit is set (has been assigned a value) and false otherwise */
    public boolean isSetLimit() {
        return EncodingUtils.testBit(__isset_bitfield, __LIMIT_ISSET_ID);
    }

    public void setLimitIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LIMIT_ISSET_ID, value);
    }

    public int getOptions() {
        return this.options;
    }

    public EzFindRequest setOptions(int options) {
        this.options = options;
        setOptionsIsSet(true);
        return this;
    }

    public void unsetOptions() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __OPTIONS_ISSET_ID);
    }

    /** Returns true if field options is set (has been assigned a value) and false otherwise */
    public boolean isSetOptions() {
        return EncodingUtils.testBit(__isset_bitfield, __OPTIONS_ISSET_ID);
    }

    public void setOptionsIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __OPTIONS_ISSET_ID, value);
    }

    public byte[] getReadPref() {
        setReadPref(org.apache.thrift.TBaseHelper.rightSize(readPref));
        return readPref == null ? null : readPref.array();
    }

    public ByteBuffer bufferForReadPref() {
        return readPref;
    }

    public EzFindRequest setReadPref(byte[] readPref) {
        setReadPref(readPref == null ? (ByteBuffer) null : ByteBuffer.wrap(readPref));
        return this;
    }

    public EzFindRequest setReadPref(ByteBuffer readPref) {
        this.readPref = readPref;
        return this;
    }

    public void unsetReadPref() {
        this.readPref = null;
    }

    /** Returns true if field readPref is set (has been assigned a value) and false otherwise */
    public boolean isSetReadPref() {
        return this.readPref != null;
    }

    public void setReadPrefIsSet(boolean value) {
        if (!value) {
            this.readPref = null;
        }
    }

    public byte[] getDecoder() {
        setDecoder(org.apache.thrift.TBaseHelper.rightSize(decoder));
        return decoder == null ? null : decoder.array();
    }

    public ByteBuffer bufferForDecoder() {
        return decoder;
    }

    public EzFindRequest setDecoder(byte[] decoder) {
        setDecoder(decoder == null ? (ByteBuffer) null : ByteBuffer.wrap(decoder));
        return this;
    }

    public EzFindRequest setDecoder(ByteBuffer decoder) {
        this.decoder = decoder;
        return this;
    }

    public void unsetDecoder() {
        this.decoder = null;
    }

    /** Returns true if field decoder is set (has been assigned a value) and false otherwise */
    public boolean isSetDecoder() {
        return this.decoder != null;
    }

    public void setDecoderIsSet(boolean value) {
        if (!value) {
            this.decoder = null;
        }
    }

    public byte[] getEncoder() {
        setEncoder(org.apache.thrift.TBaseHelper.rightSize(encoder));
        return encoder == null ? null : encoder.array();
    }

    public ByteBuffer bufferForEncoder() {
        return encoder;
    }

    public EzFindRequest setEncoder(byte[] encoder) {
        setEncoder(encoder == null ? (ByteBuffer) null : ByteBuffer.wrap(encoder));
        return this;
    }

    public EzFindRequest setEncoder(ByteBuffer encoder) {
        this.encoder = encoder;
        return this;
    }

    public void unsetEncoder() {
        this.encoder = null;
    }

    /** Returns true if field encoder is set (has been assigned a value) and false otherwise */
    public boolean isSetEncoder() {
        return this.encoder != null;
    }

    public void setEncoderIsSet(boolean value) {
        if (!value) {
            this.encoder = null;
        }
    }

    public String getCollection() {
        return this.collection;
    }

    public EzFindRequest setCollection(String collection) {
        this.collection = collection;
        return this;
    }

    public void unsetCollection() {
        this.collection = null;
    }

    /** Returns true if field collection is set (has been assigned a value) and false otherwise */
    public boolean isSetCollection() {
        return this.collection != null;
    }

    public void setCollectionIsSet(boolean value) {
        if (!value) {
            this.collection = null;
        }
    }

    public void setFieldValue(_Fields field, Object value) {
        switch (field) {
        case REF:
            if (value == null) {
                unsetRef();
            } else {
                setRef((ByteBuffer) value);
            }
            break;

        case FIELDS:
            if (value == null) {
                unsetFields();
            } else {
                setFields((ByteBuffer) value);
            }
            break;

        case NUM_TO_SKIP:
            if (value == null) {
                unsetNumToSkip();
            } else {
                setNumToSkip((Integer) value);
            }
            break;

        case BATCH_SIZE:
            if (value == null) {
                unsetBatchSize();
            } else {
                setBatchSize((Integer) value);
            }
            break;

        case LIMIT:
            if (value == null) {
                unsetLimit();
            } else {
                setLimit((Integer) value);
            }
            break;

        case OPTIONS:
            if (value == null) {
                unsetOptions();
            } else {
                setOptions((Integer) value);
            }
            break;

        case READ_PREF:
            if (value == null) {
                unsetReadPref();
            } else {
                setReadPref((ByteBuffer) value);
            }
            break;

        case DECODER:
            if (value == null) {
                unsetDecoder();
            } else {
                setDecoder((ByteBuffer) value);
            }
            break;

        case ENCODER:
            if (value == null) {
                unsetEncoder();
            } else {
                setEncoder((ByteBuffer) value);
            }
            break;

        case COLLECTION:
            if (value == null) {
                unsetCollection();
            } else {
                setCollection((String) value);
            }
            break;

        }
    }

    public Object getFieldValue(_Fields field) {
        switch (field) {
        case REF:
            return getRef();

        case FIELDS:
            return getFields();

        case NUM_TO_SKIP:
            return Integer.valueOf(getNumToSkip());

        case BATCH_SIZE:
            return Integer.valueOf(getBatchSize());

        case LIMIT:
            return Integer.valueOf(getLimit());

        case OPTIONS:
            return Integer.valueOf(getOptions());

        case READ_PREF:
            return getReadPref();

        case DECODER:
            return getDecoder();

        case ENCODER:
            return getEncoder();

        case COLLECTION:
            return getCollection();

        }
        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 REF:
            return isSetRef();
        case FIELDS:
            return isSetFields();
        case NUM_TO_SKIP:
            return isSetNumToSkip();
        case BATCH_SIZE:
            return isSetBatchSize();
        case LIMIT:
            return isSetLimit();
        case OPTIONS:
            return isSetOptions();
        case READ_PREF:
            return isSetReadPref();
        case DECODER:
            return isSetDecoder();
        case ENCODER:
            return isSetEncoder();
        case COLLECTION:
            return isSetCollection();
        }
        throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
        if (that == null)
            return false;
        if (that instanceof EzFindRequest)
            return this.equals((EzFindRequest) that);
        return false;
    }

    public boolean equals(EzFindRequest that) {
        if (that == null)
            return false;

        boolean this_present_ref = true && this.isSetRef();
        boolean that_present_ref = true && that.isSetRef();
        if (this_present_ref || that_present_ref) {
            if (!(this_present_ref && that_present_ref))
                return false;
            if (!this.ref.equals(that.ref))
                return false;
        }

        boolean this_present_fields = true && this.isSetFields();
        boolean that_present_fields = true && that.isSetFields();
        if (this_present_fields || that_present_fields) {
            if (!(this_present_fields && that_present_fields))
                return false;
            if (!this.fields.equals(that.fields))
                return false;
        }

        boolean this_present_numToSkip = true;
        boolean that_present_numToSkip = true;
        if (this_present_numToSkip || that_present_numToSkip) {
            if (!(this_present_numToSkip && that_present_numToSkip))
                return false;
            if (this.numToSkip != that.numToSkip)
                return false;
        }

        boolean this_present_batchSize = true;
        boolean that_present_batchSize = true;
        if (this_present_batchSize || that_present_batchSize) {
            if (!(this_present_batchSize && that_present_batchSize))
                return false;
            if (this.batchSize != that.batchSize)
                return false;
        }

        boolean this_present_limit = true;
        boolean that_present_limit = true;
        if (this_present_limit || that_present_limit) {
            if (!(this_present_limit && that_present_limit))
                return false;
            if (this.limit != that.limit)
                return false;
        }

        boolean this_present_options = true;
        boolean that_present_options = true;
        if (this_present_options || that_present_options) {
            if (!(this_present_options && that_present_options))
                return false;
            if (this.options != that.options)
                return false;
        }

        boolean this_present_readPref = true && this.isSetReadPref();
        boolean that_present_readPref = true && that.isSetReadPref();
        if (this_present_readPref || that_present_readPref) {
            if (!(this_present_readPref && that_present_readPref))
                return false;
            if (!this.readPref.equals(that.readPref))
                return false;
        }

        boolean this_present_decoder = true && this.isSetDecoder();
        boolean that_present_decoder = true && that.isSetDecoder();
        if (this_present_decoder || that_present_decoder) {
            if (!(this_present_decoder && that_present_decoder))
                return false;
            if (!this.decoder.equals(that.decoder))
                return false;
        }

        boolean this_present_encoder = true && this.isSetEncoder();
        boolean that_present_encoder = true && that.isSetEncoder();
        if (this_present_encoder || that_present_encoder) {
            if (!(this_present_encoder && that_present_encoder))
                return false;
            if (!this.encoder.equals(that.encoder))
                return false;
        }

        boolean this_present_collection = true && this.isSetCollection();
        boolean that_present_collection = true && that.isSetCollection();
        if (this_present_collection || that_present_collection) {
            if (!(this_present_collection && that_present_collection))
                return false;
            if (!this.collection.equals(that.collection))
                return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder builder = new HashCodeBuilder();

        boolean present_ref = true && (isSetRef());
        builder.append(present_ref);
        if (present_ref)
            builder.append(ref);

        boolean present_fields = true && (isSetFields());
        builder.append(present_fields);
        if (present_fields)
            builder.append(fields);

        boolean present_numToSkip = true;
        builder.append(present_numToSkip);
        if (present_numToSkip)
            builder.append(numToSkip);

        boolean present_batchSize = true;
        builder.append(present_batchSize);
        if (present_batchSize)
            builder.append(batchSize);

        boolean present_limit = true;
        builder.append(present_limit);
        if (present_limit)
            builder.append(limit);

        boolean present_options = true;
        builder.append(present_options);
        if (present_options)
            builder.append(options);

        boolean present_readPref = true && (isSetReadPref());
        builder.append(present_readPref);
        if (present_readPref)
            builder.append(readPref);

        boolean present_decoder = true && (isSetDecoder());
        builder.append(present_decoder);
        if (present_decoder)
            builder.append(decoder);

        boolean present_encoder = true && (isSetEncoder());
        builder.append(present_encoder);
        if (present_encoder)
            builder.append(encoder);

        boolean present_collection = true && (isSetCollection());
        builder.append(present_collection);
        if (present_collection)
            builder.append(collection);

        return builder.toHashCode();
    }

    @Override
    public int compareTo(EzFindRequest other) {
        if (!getClass().equals(other.getClass())) {
            return getClass().getName().compareTo(other.getClass().getName());
        }

        int lastComparison = 0;

        lastComparison = Boolean.valueOf(isSetRef()).compareTo(other.isSetRef());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetRef()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ref, other.ref);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetFields()).compareTo(other.isSetFields());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetFields()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fields, other.fields);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetNumToSkip()).compareTo(other.isSetNumToSkip());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetNumToSkip()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numToSkip, other.numToSkip);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetBatchSize()).compareTo(other.isSetBatchSize());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetBatchSize()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batchSize, other.batchSize);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetLimit()).compareTo(other.isSetLimit());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetLimit()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.limit, other.limit);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetOptions()).compareTo(other.isSetOptions());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetOptions()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.options, other.options);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetReadPref()).compareTo(other.isSetReadPref());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetReadPref()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.readPref, other.readPref);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetDecoder()).compareTo(other.isSetDecoder());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetDecoder()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.decoder, other.decoder);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetEncoder()).compareTo(other.isSetEncoder());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetEncoder()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.encoder, other.encoder);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetCollection()).compareTo(other.isSetCollection());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetCollection()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.collection, other.collection);
            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("EzFindRequest(");
        boolean first = true;

        sb.append("ref:");
        if (this.ref == null) {
            sb.append("null");
        } else {
            org.apache.thrift.TBaseHelper.toString(this.ref, sb);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("fields:");
        if (this.fields == null) {
            sb.append("null");
        } else {
            org.apache.thrift.TBaseHelper.toString(this.fields, sb);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("numToSkip:");
        sb.append(this.numToSkip);
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("batchSize:");
        sb.append(this.batchSize);
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("limit:");
        sb.append(this.limit);
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("options:");
        sb.append(this.options);
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("readPref:");
        if (this.readPref == null) {
            sb.append("null");
        } else {
            org.apache.thrift.TBaseHelper.toString(this.readPref, sb);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("decoder:");
        if (this.decoder == null) {
            sb.append("null");
        } else {
            org.apache.thrift.TBaseHelper.toString(this.decoder, sb);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("encoder:");
        if (this.encoder == null) {
            sb.append("null");
        } else {
            org.apache.thrift.TBaseHelper.toString(this.encoder, sb);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("collection:");
        if (this.collection == null) {
            sb.append("null");
        } else {
            sb.append(this.collection);
        }
        first = false;
        sb.append(")");
        return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
        // check for required fields
        // check for sub-struct validity
    }

    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_bitfield = 0;
            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 EzFindRequestStandardSchemeFactory implements SchemeFactory {
        public EzFindRequestStandardScheme getScheme() {
            return new EzFindRequestStandardScheme();
        }
    }

    private static class EzFindRequestStandardScheme extends StandardScheme<EzFindRequest> {

        public void read(org.apache.thrift.protocol.TProtocol iprot, EzFindRequest 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: // REF
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.ref = iprot.readBinary();
                        struct.setRefIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 2: // FIELDS
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.fields = iprot.readBinary();
                        struct.setFieldsIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 3: // NUM_TO_SKIP
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.numToSkip = iprot.readI32();
                        struct.setNumToSkipIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 4: // BATCH_SIZE
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.batchSize = iprot.readI32();
                        struct.setBatchSizeIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 5: // LIMIT
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.limit = iprot.readI32();
                        struct.setLimitIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 6: // OPTIONS
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.options = iprot.readI32();
                        struct.setOptionsIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 7: // READ_PREF
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.readPref = iprot.readBinary();
                        struct.setReadPrefIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 8: // DECODER
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.decoder = iprot.readBinary();
                        struct.setDecoderIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 9: // ENCODER
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.encoder = iprot.readBinary();
                        struct.setEncoderIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 10: // COLLECTION
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.collection = iprot.readString();
                        struct.setCollectionIsSet(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, EzFindRequest struct)
                throws org.apache.thrift.TException {
            struct.validate();

            oprot.writeStructBegin(STRUCT_DESC);
            if (struct.ref != null) {
                oprot.writeFieldBegin(REF_FIELD_DESC);
                oprot.writeBinary(struct.ref);
                oprot.writeFieldEnd();
            }
            if (struct.fields != null) {
                oprot.writeFieldBegin(FIELDS_FIELD_DESC);
                oprot.writeBinary(struct.fields);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldBegin(NUM_TO_SKIP_FIELD_DESC);
            oprot.writeI32(struct.numToSkip);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(BATCH_SIZE_FIELD_DESC);
            oprot.writeI32(struct.batchSize);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(LIMIT_FIELD_DESC);
            oprot.writeI32(struct.limit);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(OPTIONS_FIELD_DESC);
            oprot.writeI32(struct.options);
            oprot.writeFieldEnd();
            if (struct.readPref != null) {
                oprot.writeFieldBegin(READ_PREF_FIELD_DESC);
                oprot.writeBinary(struct.readPref);
                oprot.writeFieldEnd();
            }
            if (struct.decoder != null) {
                oprot.writeFieldBegin(DECODER_FIELD_DESC);
                oprot.writeBinary(struct.decoder);
                oprot.writeFieldEnd();
            }
            if (struct.encoder != null) {
                oprot.writeFieldBegin(ENCODER_FIELD_DESC);
                oprot.writeBinary(struct.encoder);
                oprot.writeFieldEnd();
            }
            if (struct.collection != null) {
                oprot.writeFieldBegin(COLLECTION_FIELD_DESC);
                oprot.writeString(struct.collection);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldStop();
            oprot.writeStructEnd();
        }

    }

    private static class EzFindRequestTupleSchemeFactory implements SchemeFactory {
        public EzFindRequestTupleScheme getScheme() {
            return new EzFindRequestTupleScheme();
        }
    }

    private static class EzFindRequestTupleScheme extends TupleScheme<EzFindRequest> {

        @Override
        public void write(org.apache.thrift.protocol.TProtocol prot, EzFindRequest struct)
                throws org.apache.thrift.TException {
            TTupleProtocol oprot = (TTupleProtocol) prot;
            BitSet optionals = new BitSet();
            if (struct.isSetRef()) {
                optionals.set(0);
            }
            if (struct.isSetFields()) {
                optionals.set(1);
            }
            if (struct.isSetNumToSkip()) {
                optionals.set(2);
            }
            if (struct.isSetBatchSize()) {
                optionals.set(3);
            }
            if (struct.isSetLimit()) {
                optionals.set(4);
            }
            if (struct.isSetOptions()) {
                optionals.set(5);
            }
            if (struct.isSetReadPref()) {
                optionals.set(6);
            }
            if (struct.isSetDecoder()) {
                optionals.set(7);
            }
            if (struct.isSetEncoder()) {
                optionals.set(8);
            }
            if (struct.isSetCollection()) {
                optionals.set(9);
            }
            oprot.writeBitSet(optionals, 10);
            if (struct.isSetRef()) {
                oprot.writeBinary(struct.ref);
            }
            if (struct.isSetFields()) {
                oprot.writeBinary(struct.fields);
            }
            if (struct.isSetNumToSkip()) {
                oprot.writeI32(struct.numToSkip);
            }
            if (struct.isSetBatchSize()) {
                oprot.writeI32(struct.batchSize);
            }
            if (struct.isSetLimit()) {
                oprot.writeI32(struct.limit);
            }
            if (struct.isSetOptions()) {
                oprot.writeI32(struct.options);
            }
            if (struct.isSetReadPref()) {
                oprot.writeBinary(struct.readPref);
            }
            if (struct.isSetDecoder()) {
                oprot.writeBinary(struct.decoder);
            }
            if (struct.isSetEncoder()) {
                oprot.writeBinary(struct.encoder);
            }
            if (struct.isSetCollection()) {
                oprot.writeString(struct.collection);
            }
        }

        @Override
        public void read(org.apache.thrift.protocol.TProtocol prot, EzFindRequest struct)
                throws org.apache.thrift.TException {
            TTupleProtocol iprot = (TTupleProtocol) prot;
            BitSet incoming = iprot.readBitSet(10);
            if (incoming.get(0)) {
                struct.ref = iprot.readBinary();
                struct.setRefIsSet(true);
            }
            if (incoming.get(1)) {
                struct.fields = iprot.readBinary();
                struct.setFieldsIsSet(true);
            }
            if (incoming.get(2)) {
                struct.numToSkip = iprot.readI32();
                struct.setNumToSkipIsSet(true);
            }
            if (incoming.get(3)) {
                struct.batchSize = iprot.readI32();
                struct.setBatchSizeIsSet(true);
            }
            if (incoming.get(4)) {
                struct.limit = iprot.readI32();
                struct.setLimitIsSet(true);
            }
            if (incoming.get(5)) {
                struct.options = iprot.readI32();
                struct.setOptionsIsSet(true);
            }
            if (incoming.get(6)) {
                struct.readPref = iprot.readBinary();
                struct.setReadPrefIsSet(true);
            }
            if (incoming.get(7)) {
                struct.decoder = iprot.readBinary();
                struct.setDecoderIsSet(true);
            }
            if (incoming.get(8)) {
                struct.encoder = iprot.readBinary();
                struct.setEncoderIsSet(true);
            }
            if (incoming.get(9)) {
                struct.collection = iprot.readString();
                struct.setCollectionIsSet(true);
            }
        }
    }

}