com.nfsdb.thrift.model.Quote.java Source code

Java tutorial

Introduction

Here is the source code for com.nfsdb.thrift.model.Quote.java

Source

/*
 * Copyright (c) 2014. Vlad Ilyushchenko
 *
 * 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.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.nfsdb.thrift.model;

import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.protocol.TTupleProtocol;
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 java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;

public class Quote implements org.apache.thrift.TBase<Quote, Quote._Fields>, java.io.Serializable, Cloneable {
    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.class);
        tmpMap.put(_Fields.TIMESTAMP,
                new org.apache.thrift.meta_data.FieldMetaData("timestamp",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
        tmpMap.put(_Fields.SYM, new org.apache.thrift.meta_data.FieldMetaData("sym",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.BID, new org.apache.thrift.meta_data.FieldMetaData("bid",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
        tmpMap.put(_Fields.ASK, new org.apache.thrift.meta_data.FieldMetaData("ask",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
        tmpMap.put(_Fields.BID_SIZE,
                new org.apache.thrift.meta_data.FieldMetaData("bidSize",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.ASK_SIZE,
                new org.apache.thrift.meta_data.FieldMetaData("askSize",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.MODE, new org.apache.thrift.meta_data.FieldMetaData("mode",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.EX, new org.apache.thrift.meta_data.FieldMetaData("ex",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        metaDataMap = Collections.unmodifiableMap(tmpMap);
        org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Quote.class, metaDataMap);
    }

    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
            "Quote");
    private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "timestamp", org.apache.thrift.protocol.TType.I64, (short) 1);
    private static final org.apache.thrift.protocol.TField SYM_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "sym", org.apache.thrift.protocol.TType.STRING, (short) 2);
    private static final org.apache.thrift.protocol.TField BID_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "bid", org.apache.thrift.protocol.TType.DOUBLE, (short) 3);
    private static final org.apache.thrift.protocol.TField ASK_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "ask", org.apache.thrift.protocol.TType.DOUBLE, (short) 4);
    private static final org.apache.thrift.protocol.TField BID_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "bidSize", org.apache.thrift.protocol.TType.I32, (short) 5);
    private static final org.apache.thrift.protocol.TField ASK_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "askSize", org.apache.thrift.protocol.TType.I32, (short) 6);
    private static final org.apache.thrift.protocol.TField MODE_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "mode", org.apache.thrift.protocol.TType.STRING, (short) 7);
    private static final org.apache.thrift.protocol.TField EX_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "ex", org.apache.thrift.protocol.TType.STRING, (short) 8);
    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<>();

    static {
        schemes.put(StandardScheme.class, new QuoteStandardSchemeFactory());
        schemes.put(TupleScheme.class, new QuoteTupleSchemeFactory());
    }

    // isset id assignments
    private static final int __TIMESTAMP_ISSET_ID = 0;
    private static final int __BID_ISSET_ID = 1;
    private static final int __ASK_ISSET_ID = 2;
    private static final int __BIDSIZE_ISSET_ID = 3;
    private static final int __ASKSIZE_ISSET_ID = 4;
    public long timestamp; // required
    public String sym; // required
    public double bid; // required
    public double ask; // required
    public int bidSize; // required
    public int askSize; // required
    public String mode; // required
    public String ex; // required
    private byte __isset_bitfield = 0;

    public Quote() {
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public Quote(Quote other) {
        __isset_bitfield = other.__isset_bitfield;
        this.timestamp = other.timestamp;
        if (other.isSetSym()) {
            this.sym = other.sym;
        }
        this.bid = other.bid;
        this.ask = other.ask;
        this.bidSize = other.bidSize;
        this.askSize = other.askSize;
        if (other.isSetMode()) {
            this.mode = other.mode;
        }
        if (other.isSetEx()) {
            this.ex = other.ex;
        }
    }

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

    @Override
    public void clear() {
        setTimestampIsSet(false);
        this.timestamp = 0;
        this.sym = null;
        setBidIsSet(false);
        this.bid = 0.0;
        setAskIsSet(false);
        this.ask = 0.0;
        setBidSizeIsSet(false);
        this.bidSize = 0;
        setAskSizeIsSet(false);
        this.askSize = 0;
        this.mode = null;
        this.ex = null;
    }

    public long getTimestamp() {
        return this.timestamp;
    }

    public Quote setTimestamp(long timestamp) {
        this.timestamp = timestamp;
        setTimestampIsSet(true);
        return this;
    }

    public void unsetTimestamp() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TIMESTAMP_ISSET_ID);
    }

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

    public void setTimestampIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
    }

    public String getSym() {
        return this.sym;
    }

    public Quote setSym(String sym) {
        this.sym = sym;
        return this;
    }

    public void unsetSym() {
        this.sym = null;
    }

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

    public void setSymIsSet(boolean value) {
        if (!value) {
            this.sym = null;
        }
    }

    public double getBid() {
        return this.bid;
    }

    public Quote setBid(double bid) {
        this.bid = bid;
        setBidIsSet(true);
        return this;
    }

    public void unsetBid() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BID_ISSET_ID);
    }

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

    public void setBidIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BID_ISSET_ID, value);
    }

    public double getAsk() {
        return this.ask;
    }

    public Quote setAsk(double ask) {
        this.ask = ask;
        setAskIsSet(true);
        return this;
    }

    public void unsetAsk() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ASK_ISSET_ID);
    }

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

    public void setAskIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ASK_ISSET_ID, value);
    }

    public int getBidSize() {
        return this.bidSize;
    }

    public Quote setBidSize(int bidSize) {
        this.bidSize = bidSize;
        setBidSizeIsSet(true);
        return this;
    }

    public void unsetBidSize() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __BIDSIZE_ISSET_ID);
    }

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

    public void setBidSizeIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BIDSIZE_ISSET_ID, value);
    }

    public int getAskSize() {
        return this.askSize;
    }

    public Quote setAskSize(int askSize) {
        this.askSize = askSize;
        setAskSizeIsSet(true);
        return this;
    }

    public void unsetAskSize() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ASKSIZE_ISSET_ID);
    }

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

    public void setAskSizeIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ASKSIZE_ISSET_ID, value);
    }

    public String getMode() {
        return this.mode;
    }

    public Quote setMode(String mode) {
        this.mode = mode;
        return this;
    }

    public void unsetMode() {
        this.mode = null;
    }

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

    public void setModeIsSet(boolean value) {
        if (!value) {
            this.mode = null;
        }
    }

    public String getEx() {
        return this.ex;
    }

    public Quote setEx(String ex) {
        this.ex = ex;
        return this;
    }

    public void unsetEx() {
        this.ex = null;
    }

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

    public void setExIsSet(boolean value) {
        if (!value) {
            this.ex = null;
        }
    }

    public void setFieldValue(_Fields field, Object value) {
        switch (field) {
        case TIMESTAMP:
            if (value == null) {
                unsetTimestamp();
            } else {
                setTimestamp((Long) value);
            }
            break;

        case SYM:
            if (value == null) {
                unsetSym();
            } else {
                setSym((String) value);
            }
            break;

        case BID:
            if (value == null) {
                unsetBid();
            } else {
                setBid((Double) value);
            }
            break;

        case ASK:
            if (value == null) {
                unsetAsk();
            } else {
                setAsk((Double) value);
            }
            break;

        case BID_SIZE:
            if (value == null) {
                unsetBidSize();
            } else {
                setBidSize((Integer) value);
            }
            break;

        case ASK_SIZE:
            if (value == null) {
                unsetAskSize();
            } else {
                setAskSize((Integer) value);
            }
            break;

        case MODE:
            if (value == null) {
                unsetMode();
            } else {
                setMode((String) value);
            }
            break;

        case EX:
            if (value == null) {
                unsetEx();
            } else {
                setEx((String) value);
            }
            break;

        }
    }

    public Object getFieldValue(_Fields field) {
        switch (field) {
        case TIMESTAMP:
            return getTimestamp();

        case SYM:
            return getSym();

        case BID:
            return getBid();

        case ASK:
            return getAsk();

        case BID_SIZE:
            return getBidSize();

        case ASK_SIZE:
            return getAskSize();

        case MODE:
            return getMode();

        case EX:
            return getEx();

        }
        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 TIMESTAMP:
            return isSetTimestamp();
        case SYM:
            return isSetSym();
        case BID:
            return isSetBid();
        case ASK:
            return isSetAsk();
        case BID_SIZE:
            return isSetBidSize();
        case ASK_SIZE:
            return isSetAskSize();
        case MODE:
            return isSetMode();
        case EX:
            return isSetEx();
        }
        throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
        return that != null && that instanceof Quote && this.equals((Quote) that);
    }

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

        if (this.timestamp != that.timestamp)
            return false;

        boolean this_present_sym = this.isSetSym();
        boolean that_present_sym = that.isSetSym();
        if (this_present_sym || that_present_sym) {
            if (!(this_present_sym && that_present_sym))
                return false;
            if (!this.sym.equals(that.sym))
                return false;
        }

        if (this.bid != that.bid)
            return false;

        if (this.ask != that.ask)
            return false;

        if (this.bidSize != that.bidSize)
            return false;

        if (this.askSize != that.askSize)
            return false;

        boolean this_present_mode = this.isSetMode();
        boolean that_present_mode = that.isSetMode();
        if (this_present_mode || that_present_mode) {
            if (!(this_present_mode && that_present_mode))
                return false;
            if (!this.mode.equals(that.mode))
                return false;
        }

        boolean this_present_ex = this.isSetEx();
        boolean that_present_ex = that.isSetEx();
        if (this_present_ex || that_present_ex) {
            if (!(this_present_ex && that_present_ex))
                return false;
            if (!this.ex.equals(that.ex))
                return false;
        }

        return true;
    }

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

        builder.append(true);
        builder.append(timestamp);

        boolean present_sym = (isSetSym());
        builder.append(present_sym);
        if (present_sym)
            builder.append(sym);

        builder.append(true);
        builder.append(bid);

        builder.append(true);
        builder.append(ask);

        builder.append(true);
        builder.append(bidSize);

        builder.append(true);
        builder.append(askSize);

        boolean present_mode = (isSetMode());
        builder.append(present_mode);
        if (present_mode)
            builder.append(mode);

        boolean present_ex = (isSetEx());
        builder.append(present_ex);
        if (present_ex)
            builder.append(ex);

        return builder.toHashCode();
    }

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

        int lastComparison;

        lastComparison = Boolean.valueOf(isSetTimestamp()).compareTo(other.isSetTimestamp());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetTimestamp()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timestamp, other.timestamp);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetSym()).compareTo(other.isSetSym());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetSym()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sym, other.sym);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetBid()).compareTo(other.isSetBid());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetBid()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bid, other.bid);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetAsk()).compareTo(other.isSetAsk());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetAsk()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ask, other.ask);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetBidSize()).compareTo(other.isSetBidSize());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetBidSize()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bidSize, other.bidSize);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetAskSize()).compareTo(other.isSetAskSize());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetAskSize()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.askSize, other.askSize);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetMode()).compareTo(other.isSetMode());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetMode()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mode, other.mode);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetEx()).compareTo(other.isSetEx());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetEx()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ex, other.ex);
            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("Quote(");
        sb.append("timestamp:");
        sb.append(this.timestamp);
        sb.append(", ");
        sb.append("sym:");
        if (this.sym == null) {
            sb.append("null");
        } else {
            sb.append(this.sym);
        }
        sb.append(", ");
        sb.append("bid:");
        sb.append(this.bid);
        sb.append(", ");
        sb.append("ask:");
        sb.append(this.ask);
        sb.append(", ");
        sb.append("bidSize:");
        sb.append(this.bidSize);
        sb.append(", ");
        sb.append("askSize:");
        sb.append(this.askSize);
        sb.append(", ");
        sb.append("mode:");
        if (this.mode == null) {
            sb.append("null");
        } else {
            sb.append(this.mode);
        }
        sb.append(", ");
        sb.append("ex:");
        if (this.ex == null) {
            sb.append("null");
        } else {
            sb.append(this.ex);
        }
        sb.append(")");
        return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
        // check for required fields
        // alas, we cannot check 'timestamp' because it's a primitive and you chose the non-beans generator.
        if (sym == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'sym' was not present! Struct: " + toString());
        }
        // alas, we cannot check 'bid' because it's a primitive and you chose the non-beans generator.
        // alas, we cannot check 'ask' because it's a primitive and you chose the non-beans generator.
        // alas, we cannot check 'bidSize' because it's a primitive and you chose the non-beans generator.
        // alas, we cannot check 'askSize' because it's a primitive and you chose the non-beans generator.
        if (mode == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'mode' was not present! Struct: " + toString());
        }
        if (ex == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'ex' was not present! Struct: " + toString());
        }
        // 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 {
        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);
        }
    }

    /**
     * The set of fields this struct contains, along with convenience methods for finding and manipulating them.
     */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
        TIMESTAMP((short) 1, "timestamp"), SYM((short) 2, "sym"), BID((short) 3, "bid"), ASK((short) 4,
                "ask"), BID_SIZE((short) 5,
                        "bidSize"), ASK_SIZE((short) 6, "askSize"), MODE((short) 7, "mode"), EX((short) 8, "ex");

        private final short _thriftId;
        private final String _fieldName;

        /**
         * Find the _Fields constant that matches fieldId, or null if its not found.
         */
        public static _Fields findByThriftId(int fieldId) {
            switch (fieldId) {
            case 1: // TIMESTAMP
                return TIMESTAMP;
            case 2: // SYM
                return SYM;
            case 3: // BID
                return BID;
            case 4: // ASK
                return ASK;
            case 5: // BID_SIZE
                return BID_SIZE;
            case 6: // ASK_SIZE
                return ASK_SIZE;
            case 7: // MODE
                return MODE;
            case 8: // EX
                return EX;
            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;
        }

        public short getThriftFieldId() {
            return _thriftId;
        }

        public String getFieldName() {
            return _fieldName;
        }

        _Fields(short thriftId, String fieldName) {
            _thriftId = thriftId;
            _fieldName = fieldName;
        }
    }

    private static class QuoteStandardSchemeFactory implements SchemeFactory {
        public QuoteStandardScheme getScheme() {
            return new QuoteStandardScheme();
        }
    }

    private static class QuoteStandardScheme extends StandardScheme<Quote> {

        public void read(org.apache.thrift.protocol.TProtocol iprot, Quote 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: // TIMESTAMP
                    if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                        struct.timestamp = iprot.readI64();
                        struct.setTimestampIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 2: // SYM
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.sym = iprot.readString();
                        struct.setSymIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 3: // BID
                    if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
                        struct.bid = iprot.readDouble();
                        struct.setBidIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 4: // ASK
                    if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
                        struct.ask = iprot.readDouble();
                        struct.setAskIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 5: // BID_SIZE
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.bidSize = iprot.readI32();
                        struct.setBidSizeIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 6: // ASK_SIZE
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.askSize = iprot.readI32();
                        struct.setAskSizeIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 7: // MODE
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.mode = iprot.readString();
                        struct.setModeIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 8: // EX
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.ex = iprot.readString();
                        struct.setExIsSet(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
            if (!struct.isSetTimestamp()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'timestamp' was not found in serialized data! Struct: " + toString());
            }
            if (!struct.isSetBid()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'bid' was not found in serialized data! Struct: " + toString());
            }
            if (!struct.isSetAsk()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'ask' was not found in serialized data! Struct: " + toString());
            }
            if (!struct.isSetBidSize()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'bidSize' was not found in serialized data! Struct: " + toString());
            }
            if (!struct.isSetAskSize()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'askSize' was not found in serialized data! Struct: " + toString());
            }
            struct.validate();
        }

        public void write(org.apache.thrift.protocol.TProtocol oprot, Quote struct)
                throws org.apache.thrift.TException {
            struct.validate();

            oprot.writeStructBegin(STRUCT_DESC);
            oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
            oprot.writeI64(struct.timestamp);
            oprot.writeFieldEnd();
            if (struct.sym != null) {
                oprot.writeFieldBegin(SYM_FIELD_DESC);
                oprot.writeString(struct.sym);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldBegin(BID_FIELD_DESC);
            oprot.writeDouble(struct.bid);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(ASK_FIELD_DESC);
            oprot.writeDouble(struct.ask);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(BID_SIZE_FIELD_DESC);
            oprot.writeI32(struct.bidSize);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(ASK_SIZE_FIELD_DESC);
            oprot.writeI32(struct.askSize);
            oprot.writeFieldEnd();
            if (struct.mode != null) {
                oprot.writeFieldBegin(MODE_FIELD_DESC);
                oprot.writeString(struct.mode);
                oprot.writeFieldEnd();
            }
            if (struct.ex != null) {
                oprot.writeFieldBegin(EX_FIELD_DESC);
                oprot.writeString(struct.ex);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldStop();
            oprot.writeStructEnd();
        }

    }

    private static class QuoteTupleSchemeFactory implements SchemeFactory {
        public QuoteTupleScheme getScheme() {
            return new QuoteTupleScheme();
        }
    }

    private static class QuoteTupleScheme extends TupleScheme<Quote> {

        @Override
        public void write(org.apache.thrift.protocol.TProtocol prot, Quote struct)
                throws org.apache.thrift.TException {
            TTupleProtocol oprot = (TTupleProtocol) prot;
            oprot.writeI64(struct.timestamp);
            oprot.writeString(struct.sym);
            oprot.writeDouble(struct.bid);
            oprot.writeDouble(struct.ask);
            oprot.writeI32(struct.bidSize);
            oprot.writeI32(struct.askSize);
            oprot.writeString(struct.mode);
            oprot.writeString(struct.ex);
        }

        @Override
        public void read(org.apache.thrift.protocol.TProtocol prot, Quote struct)
                throws org.apache.thrift.TException {
            TTupleProtocol iprot = (TTupleProtocol) prot;
            struct.timestamp = iprot.readI64();
            struct.setTimestampIsSet(true);
            struct.sym = iprot.readString();
            struct.setSymIsSet(true);
            struct.bid = iprot.readDouble();
            struct.setBidIsSet(true);
            struct.ask = iprot.readDouble();
            struct.setAskIsSet(true);
            struct.bidSize = iprot.readI32();
            struct.setBidSizeIsSet(true);
            struct.askSize = iprot.readI32();
            struct.setAskSizeIsSet(true);
            struct.mode = iprot.readString();
            struct.setModeIsSet(true);
            struct.ex = iprot.readString();
            struct.setExIsSet(true);
        }
    }

}