ezbake.data.mongo.thrift.MongoFindParams.java Source code

Java tutorial

Introduction

Here is the source code for ezbake.data.mongo.thrift.MongoFindParams.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.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 MongoFindParams implements org.apache.thrift.TBase<MongoFindParams, MongoFindParams._Fields>,
        java.io.Serializable, Cloneable, Comparable<MongoFindParams> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
            "MongoFindParams");

    private static final org.apache.thrift.protocol.TField JSON_QUERY_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "jsonQuery", org.apache.thrift.protocol.TType.STRING, (short) 1);
    private static final org.apache.thrift.protocol.TField JSON_PROJECTION_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "jsonProjection", org.apache.thrift.protocol.TType.STRING, (short) 2);
    private static final org.apache.thrift.protocol.TField JSON_SORT_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "jsonSort", org.apache.thrift.protocol.TType.STRING, (short) 3);
    private static final org.apache.thrift.protocol.TField SKIP_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "skip", 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 RETURN_PLAIN_OBJECT_ID_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "returnPlainObjectIdString", org.apache.thrift.protocol.TType.BOOL, (short) 6);

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

    public String jsonQuery; // optional
    public String jsonProjection; // optional
    public String jsonSort; // optional
    public int skip; // optional
    public int limit; // optional
    public boolean returnPlainObjectIdString; // optional

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
        JSON_QUERY((short) 1, "jsonQuery"), JSON_PROJECTION((short) 2, "jsonProjection"), JSON_SORT((short) 3,
                "jsonSort"), SKIP((short) 4, "skip"), LIMIT((short) 5,
                        "limit"), RETURN_PLAIN_OBJECT_ID_STRING((short) 6, "returnPlainObjectIdString");

        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: // JSON_QUERY
                return JSON_QUERY;
            case 2: // JSON_PROJECTION
                return JSON_PROJECTION;
            case 3: // JSON_SORT
                return JSON_SORT;
            case 4: // SKIP
                return SKIP;
            case 5: // LIMIT
                return LIMIT;
            case 6: // RETURN_PLAIN_OBJECT_ID_STRING
                return RETURN_PLAIN_OBJECT_ID_STRING;
            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 __SKIP_ISSET_ID = 0;
    private static final int __LIMIT_ISSET_ID = 1;
    private static final int __RETURNPLAINOBJECTIDSTRING_ISSET_ID = 2;
    private byte __isset_bitfield = 0;
    private _Fields optionals[] = { _Fields.JSON_QUERY, _Fields.JSON_PROJECTION, _Fields.JSON_SORT, _Fields.SKIP,
            _Fields.LIMIT, _Fields.RETURN_PLAIN_OBJECT_ID_STRING };
    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.JSON_QUERY, new org.apache.thrift.meta_data.FieldMetaData("jsonQuery",
                org.apache.thrift.TFieldRequirementType.OPTIONAL,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.JSON_PROJECTION, new org.apache.thrift.meta_data.FieldMetaData("jsonProjection",
                org.apache.thrift.TFieldRequirementType.OPTIONAL,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.JSON_SORT, new org.apache.thrift.meta_data.FieldMetaData("jsonSort",
                org.apache.thrift.TFieldRequirementType.OPTIONAL,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.SKIP,
                new org.apache.thrift.meta_data.FieldMetaData("skip",
                        org.apache.thrift.TFieldRequirementType.OPTIONAL,
                        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.OPTIONAL,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.RETURN_PLAIN_OBJECT_ID_STRING,
                new org.apache.thrift.meta_data.FieldMetaData("returnPlainObjectIdString",
                        org.apache.thrift.TFieldRequirementType.OPTIONAL,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
        metaDataMap = Collections.unmodifiableMap(tmpMap);
        org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(MongoFindParams.class, metaDataMap);
    }

    public MongoFindParams() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public MongoFindParams(MongoFindParams other) {
        __isset_bitfield = other.__isset_bitfield;
        if (other.isSetJsonQuery()) {
            this.jsonQuery = other.jsonQuery;
        }
        if (other.isSetJsonProjection()) {
            this.jsonProjection = other.jsonProjection;
        }
        if (other.isSetJsonSort()) {
            this.jsonSort = other.jsonSort;
        }
        this.skip = other.skip;
        this.limit = other.limit;
        this.returnPlainObjectIdString = other.returnPlainObjectIdString;
    }

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

    @Override
    public void clear() {
        this.jsonQuery = null;
        this.jsonProjection = null;
        this.jsonSort = null;
        setSkipIsSet(false);
        this.skip = 0;
        setLimitIsSet(false);
        this.limit = 0;
        setReturnPlainObjectIdStringIsSet(false);
        this.returnPlainObjectIdString = false;
    }

    public String getJsonQuery() {
        return this.jsonQuery;
    }

    public MongoFindParams setJsonQuery(String jsonQuery) {
        this.jsonQuery = jsonQuery;
        return this;
    }

    public void unsetJsonQuery() {
        this.jsonQuery = null;
    }

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

    public void setJsonQueryIsSet(boolean value) {
        if (!value) {
            this.jsonQuery = null;
        }
    }

    public String getJsonProjection() {
        return this.jsonProjection;
    }

    public MongoFindParams setJsonProjection(String jsonProjection) {
        this.jsonProjection = jsonProjection;
        return this;
    }

    public void unsetJsonProjection() {
        this.jsonProjection = null;
    }

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

    public void setJsonProjectionIsSet(boolean value) {
        if (!value) {
            this.jsonProjection = null;
        }
    }

    public String getJsonSort() {
        return this.jsonSort;
    }

    public MongoFindParams setJsonSort(String jsonSort) {
        this.jsonSort = jsonSort;
        return this;
    }

    public void unsetJsonSort() {
        this.jsonSort = null;
    }

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

    public void setJsonSortIsSet(boolean value) {
        if (!value) {
            this.jsonSort = null;
        }
    }

    public int getSkip() {
        return this.skip;
    }

    public MongoFindParams setSkip(int skip) {
        this.skip = skip;
        setSkipIsSet(true);
        return this;
    }

    public void unsetSkip() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SKIP_ISSET_ID);
    }

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

    public void setSkipIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SKIP_ISSET_ID, value);
    }

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

    public MongoFindParams 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 boolean isReturnPlainObjectIdString() {
        return this.returnPlainObjectIdString;
    }

    public MongoFindParams setReturnPlainObjectIdString(boolean returnPlainObjectIdString) {
        this.returnPlainObjectIdString = returnPlainObjectIdString;
        setReturnPlainObjectIdStringIsSet(true);
        return this;
    }

    public void unsetReturnPlainObjectIdString() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RETURNPLAINOBJECTIDSTRING_ISSET_ID);
    }

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

    public void setReturnPlainObjectIdStringIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RETURNPLAINOBJECTIDSTRING_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
        switch (field) {
        case JSON_QUERY:
            if (value == null) {
                unsetJsonQuery();
            } else {
                setJsonQuery((String) value);
            }
            break;

        case JSON_PROJECTION:
            if (value == null) {
                unsetJsonProjection();
            } else {
                setJsonProjection((String) value);
            }
            break;

        case JSON_SORT:
            if (value == null) {
                unsetJsonSort();
            } else {
                setJsonSort((String) value);
            }
            break;

        case SKIP:
            if (value == null) {
                unsetSkip();
            } else {
                setSkip((Integer) value);
            }
            break;

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

        case RETURN_PLAIN_OBJECT_ID_STRING:
            if (value == null) {
                unsetReturnPlainObjectIdString();
            } else {
                setReturnPlainObjectIdString((Boolean) value);
            }
            break;

        }
    }

    public Object getFieldValue(_Fields field) {
        switch (field) {
        case JSON_QUERY:
            return getJsonQuery();

        case JSON_PROJECTION:
            return getJsonProjection();

        case JSON_SORT:
            return getJsonSort();

        case SKIP:
            return Integer.valueOf(getSkip());

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

        case RETURN_PLAIN_OBJECT_ID_STRING:
            return Boolean.valueOf(isReturnPlainObjectIdString());

        }
        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 JSON_QUERY:
            return isSetJsonQuery();
        case JSON_PROJECTION:
            return isSetJsonProjection();
        case JSON_SORT:
            return isSetJsonSort();
        case SKIP:
            return isSetSkip();
        case LIMIT:
            return isSetLimit();
        case RETURN_PLAIN_OBJECT_ID_STRING:
            return isSetReturnPlainObjectIdString();
        }
        throw new IllegalStateException();
    }

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

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

        boolean this_present_jsonQuery = true && this.isSetJsonQuery();
        boolean that_present_jsonQuery = true && that.isSetJsonQuery();
        if (this_present_jsonQuery || that_present_jsonQuery) {
            if (!(this_present_jsonQuery && that_present_jsonQuery))
                return false;
            if (!this.jsonQuery.equals(that.jsonQuery))
                return false;
        }

        boolean this_present_jsonProjection = true && this.isSetJsonProjection();
        boolean that_present_jsonProjection = true && that.isSetJsonProjection();
        if (this_present_jsonProjection || that_present_jsonProjection) {
            if (!(this_present_jsonProjection && that_present_jsonProjection))
                return false;
            if (!this.jsonProjection.equals(that.jsonProjection))
                return false;
        }

        boolean this_present_jsonSort = true && this.isSetJsonSort();
        boolean that_present_jsonSort = true && that.isSetJsonSort();
        if (this_present_jsonSort || that_present_jsonSort) {
            if (!(this_present_jsonSort && that_present_jsonSort))
                return false;
            if (!this.jsonSort.equals(that.jsonSort))
                return false;
        }

        boolean this_present_skip = true && this.isSetSkip();
        boolean that_present_skip = true && that.isSetSkip();
        if (this_present_skip || that_present_skip) {
            if (!(this_present_skip && that_present_skip))
                return false;
            if (this.skip != that.skip)
                return false;
        }

        boolean this_present_limit = true && this.isSetLimit();
        boolean that_present_limit = true && that.isSetLimit();
        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_returnPlainObjectIdString = true && this.isSetReturnPlainObjectIdString();
        boolean that_present_returnPlainObjectIdString = true && that.isSetReturnPlainObjectIdString();
        if (this_present_returnPlainObjectIdString || that_present_returnPlainObjectIdString) {
            if (!(this_present_returnPlainObjectIdString && that_present_returnPlainObjectIdString))
                return false;
            if (this.returnPlainObjectIdString != that.returnPlainObjectIdString)
                return false;
        }

        return true;
    }

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

        boolean present_jsonQuery = true && (isSetJsonQuery());
        builder.append(present_jsonQuery);
        if (present_jsonQuery)
            builder.append(jsonQuery);

        boolean present_jsonProjection = true && (isSetJsonProjection());
        builder.append(present_jsonProjection);
        if (present_jsonProjection)
            builder.append(jsonProjection);

        boolean present_jsonSort = true && (isSetJsonSort());
        builder.append(present_jsonSort);
        if (present_jsonSort)
            builder.append(jsonSort);

        boolean present_skip = true && (isSetSkip());
        builder.append(present_skip);
        if (present_skip)
            builder.append(skip);

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

        boolean present_returnPlainObjectIdString = true && (isSetReturnPlainObjectIdString());
        builder.append(present_returnPlainObjectIdString);
        if (present_returnPlainObjectIdString)
            builder.append(returnPlainObjectIdString);

        return builder.toHashCode();
    }

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

        int lastComparison = 0;

        lastComparison = Boolean.valueOf(isSetJsonQuery()).compareTo(other.isSetJsonQuery());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetJsonQuery()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jsonQuery, other.jsonQuery);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetJsonProjection()).compareTo(other.isSetJsonProjection());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetJsonProjection()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jsonProjection, other.jsonProjection);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetJsonSort()).compareTo(other.isSetJsonSort());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetJsonSort()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.jsonSort, other.jsonSort);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetSkip()).compareTo(other.isSetSkip());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetSkip()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.skip, other.skip);
            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(isSetReturnPlainObjectIdString())
                .compareTo(other.isSetReturnPlainObjectIdString());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetReturnPlainObjectIdString()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.returnPlainObjectIdString,
                    other.returnPlainObjectIdString);
            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("MongoFindParams(");
        boolean first = true;

        if (isSetJsonQuery()) {
            sb.append("jsonQuery:");
            if (this.jsonQuery == null) {
                sb.append("null");
            } else {
                sb.append(this.jsonQuery);
            }
            first = false;
        }
        if (isSetJsonProjection()) {
            if (!first)
                sb.append(", ");
            sb.append("jsonProjection:");
            if (this.jsonProjection == null) {
                sb.append("null");
            } else {
                sb.append(this.jsonProjection);
            }
            first = false;
        }
        if (isSetJsonSort()) {
            if (!first)
                sb.append(", ");
            sb.append("jsonSort:");
            if (this.jsonSort == null) {
                sb.append("null");
            } else {
                sb.append(this.jsonSort);
            }
            first = false;
        }
        if (isSetSkip()) {
            if (!first)
                sb.append(", ");
            sb.append("skip:");
            sb.append(this.skip);
            first = false;
        }
        if (isSetLimit()) {
            if (!first)
                sb.append(", ");
            sb.append("limit:");
            sb.append(this.limit);
            first = false;
        }
        if (isSetReturnPlainObjectIdString()) {
            if (!first)
                sb.append(", ");
            sb.append("returnPlainObjectIdString:");
            sb.append(this.returnPlainObjectIdString);
            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 MongoFindParamsStandardSchemeFactory implements SchemeFactory {
        public MongoFindParamsStandardScheme getScheme() {
            return new MongoFindParamsStandardScheme();
        }
    }

    private static class MongoFindParamsStandardScheme extends StandardScheme<MongoFindParams> {

        public void read(org.apache.thrift.protocol.TProtocol iprot, MongoFindParams 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: // JSON_QUERY
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.jsonQuery = iprot.readString();
                        struct.setJsonQueryIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 2: // JSON_PROJECTION
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.jsonProjection = iprot.readString();
                        struct.setJsonProjectionIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 3: // JSON_SORT
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.jsonSort = iprot.readString();
                        struct.setJsonSortIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 4: // SKIP
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.skip = iprot.readI32();
                        struct.setSkipIsSet(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: // RETURN_PLAIN_OBJECT_ID_STRING
                    if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
                        struct.returnPlainObjectIdString = iprot.readBool();
                        struct.setReturnPlainObjectIdStringIsSet(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, MongoFindParams struct)
                throws org.apache.thrift.TException {
            struct.validate();

            oprot.writeStructBegin(STRUCT_DESC);
            if (struct.jsonQuery != null) {
                if (struct.isSetJsonQuery()) {
                    oprot.writeFieldBegin(JSON_QUERY_FIELD_DESC);
                    oprot.writeString(struct.jsonQuery);
                    oprot.writeFieldEnd();
                }
            }
            if (struct.jsonProjection != null) {
                if (struct.isSetJsonProjection()) {
                    oprot.writeFieldBegin(JSON_PROJECTION_FIELD_DESC);
                    oprot.writeString(struct.jsonProjection);
                    oprot.writeFieldEnd();
                }
            }
            if (struct.jsonSort != null) {
                if (struct.isSetJsonSort()) {
                    oprot.writeFieldBegin(JSON_SORT_FIELD_DESC);
                    oprot.writeString(struct.jsonSort);
                    oprot.writeFieldEnd();
                }
            }
            if (struct.isSetSkip()) {
                oprot.writeFieldBegin(SKIP_FIELD_DESC);
                oprot.writeI32(struct.skip);
                oprot.writeFieldEnd();
            }
            if (struct.isSetLimit()) {
                oprot.writeFieldBegin(LIMIT_FIELD_DESC);
                oprot.writeI32(struct.limit);
                oprot.writeFieldEnd();
            }
            if (struct.isSetReturnPlainObjectIdString()) {
                oprot.writeFieldBegin(RETURN_PLAIN_OBJECT_ID_STRING_FIELD_DESC);
                oprot.writeBool(struct.returnPlainObjectIdString);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldStop();
            oprot.writeStructEnd();
        }

    }

    private static class MongoFindParamsTupleSchemeFactory implements SchemeFactory {
        public MongoFindParamsTupleScheme getScheme() {
            return new MongoFindParamsTupleScheme();
        }
    }

    private static class MongoFindParamsTupleScheme extends TupleScheme<MongoFindParams> {

        @Override
        public void write(org.apache.thrift.protocol.TProtocol prot, MongoFindParams struct)
                throws org.apache.thrift.TException {
            TTupleProtocol oprot = (TTupleProtocol) prot;
            BitSet optionals = new BitSet();
            if (struct.isSetJsonQuery()) {
                optionals.set(0);
            }
            if (struct.isSetJsonProjection()) {
                optionals.set(1);
            }
            if (struct.isSetJsonSort()) {
                optionals.set(2);
            }
            if (struct.isSetSkip()) {
                optionals.set(3);
            }
            if (struct.isSetLimit()) {
                optionals.set(4);
            }
            if (struct.isSetReturnPlainObjectIdString()) {
                optionals.set(5);
            }
            oprot.writeBitSet(optionals, 6);
            if (struct.isSetJsonQuery()) {
                oprot.writeString(struct.jsonQuery);
            }
            if (struct.isSetJsonProjection()) {
                oprot.writeString(struct.jsonProjection);
            }
            if (struct.isSetJsonSort()) {
                oprot.writeString(struct.jsonSort);
            }
            if (struct.isSetSkip()) {
                oprot.writeI32(struct.skip);
            }
            if (struct.isSetLimit()) {
                oprot.writeI32(struct.limit);
            }
            if (struct.isSetReturnPlainObjectIdString()) {
                oprot.writeBool(struct.returnPlainObjectIdString);
            }
        }

        @Override
        public void read(org.apache.thrift.protocol.TProtocol prot, MongoFindParams struct)
                throws org.apache.thrift.TException {
            TTupleProtocol iprot = (TTupleProtocol) prot;
            BitSet incoming = iprot.readBitSet(6);
            if (incoming.get(0)) {
                struct.jsonQuery = iprot.readString();
                struct.setJsonQueryIsSet(true);
            }
            if (incoming.get(1)) {
                struct.jsonProjection = iprot.readString();
                struct.setJsonProjectionIsSet(true);
            }
            if (incoming.get(2)) {
                struct.jsonSort = iprot.readString();
                struct.setJsonSortIsSet(true);
            }
            if (incoming.get(3)) {
                struct.skip = iprot.readI32();
                struct.setSkipIsSet(true);
            }
            if (incoming.get(4)) {
                struct.limit = iprot.readI32();
                struct.setLimitIsSet(true);
            }
            if (incoming.get(5)) {
                struct.returnPlainObjectIdString = iprot.readBool();
                struct.setReturnPlainObjectIdStringIsSet(true);
            }
        }
    }

}