/**
 * Autogenerated by Thrift Compiler (0.10.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.navercorp.pinpoint.thrift.dto;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)", date = "2019-01-24")
public class TSpanChunk implements org.apache.thrift.TBase<TSpanChunk, TSpanChunk._Fields>, java.io.Serializable, Cloneable, Comparable<TSpanChunk> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSpanChunk");

  private static final org.apache.thrift.protocol.TField AGENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("agentId", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationName", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField AGENT_START_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("agentStartTime", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField SERVICE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("serviceType", org.apache.thrift.protocol.TType.I16, (short)4);
  private static final org.apache.thrift.protocol.TField TRANSACTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("transactionId", org.apache.thrift.protocol.TType.STRING, (short)5);
  private static final org.apache.thrift.protocol.TField SPAN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("spanId", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField END_POINT_FIELD_DESC = new org.apache.thrift.protocol.TField("endPoint", org.apache.thrift.protocol.TType.STRING, (short)9);
  private static final org.apache.thrift.protocol.TField SPAN_EVENT_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("spanEventList", org.apache.thrift.protocol.TType.LIST, (short)10);
  private static final org.apache.thrift.protocol.TField APPLICATION_SERVICE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationServiceType", org.apache.thrift.protocol.TType.I16, (short)11);
  private static final org.apache.thrift.protocol.TField KEY_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("keyTime", org.apache.thrift.protocol.TType.I64, (short)12);
  private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.BYTE, (short)13);
  private static final org.apache.thrift.protocol.TField LOCAL_ASYNC_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("localAsyncId", org.apache.thrift.protocol.TType.STRUCT, (short)14);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TSpanChunkStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TSpanChunkTupleSchemeFactory();

  private java.lang.String agentId; // required
  private java.lang.String applicationName; // required
  private long agentStartTime; // required
  private short serviceType; // required
  private java.nio.ByteBuffer transactionId; // required
  private long spanId; // required
  private java.lang.String endPoint; // optional
  private java.util.List<TSpanEvent> spanEventList; // required
  private short applicationServiceType; // optional
  private long keyTime; // optional
  private byte version; // optional
  private TLocalAsyncId localAsyncId; // 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 {
    AGENT_ID((short)1, "agentId"),
    APPLICATION_NAME((short)2, "applicationName"),
    AGENT_START_TIME((short)3, "agentStartTime"),
    SERVICE_TYPE((short)4, "serviceType"),
    TRANSACTION_ID((short)5, "transactionId"),
    SPAN_ID((short)8, "spanId"),
    END_POINT((short)9, "endPoint"),
    SPAN_EVENT_LIST((short)10, "spanEventList"),
    APPLICATION_SERVICE_TYPE((short)11, "applicationServiceType"),
    KEY_TIME((short)12, "keyTime"),
    VERSION((short)13, "version"),
    LOCAL_ASYNC_ID((short)14, "localAsyncId");

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

    static {
      for (_Fields field : java.util.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: // AGENT_ID
          return AGENT_ID;
        case 2: // APPLICATION_NAME
          return APPLICATION_NAME;
        case 3: // AGENT_START_TIME
          return AGENT_START_TIME;
        case 4: // SERVICE_TYPE
          return SERVICE_TYPE;
        case 5: // TRANSACTION_ID
          return TRANSACTION_ID;
        case 8: // SPAN_ID
          return SPAN_ID;
        case 9: // END_POINT
          return END_POINT;
        case 10: // SPAN_EVENT_LIST
          return SPAN_EVENT_LIST;
        case 11: // APPLICATION_SERVICE_TYPE
          return APPLICATION_SERVICE_TYPE;
        case 12: // KEY_TIME
          return KEY_TIME;
        case 13: // VERSION
          return VERSION;
        case 14: // LOCAL_ASYNC_ID
          return LOCAL_ASYNC_ID;
        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 java.lang.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(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

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

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __AGENTSTARTTIME_ISSET_ID = 0;
  private static final int __SERVICETYPE_ISSET_ID = 1;
  private static final int __SPANID_ISSET_ID = 2;
  private static final int __APPLICATIONSERVICETYPE_ISSET_ID = 3;
  private static final int __KEYTIME_ISSET_ID = 4;
  private static final int __VERSION_ISSET_ID = 5;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.END_POINT,_Fields.APPLICATION_SERVICE_TYPE,_Fields.KEY_TIME,_Fields.VERSION,_Fields.LOCAL_ASYNC_ID};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.AGENT_ID, new org.apache.thrift.meta_data.FieldMetaData("agentId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.APPLICATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("applicationName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.AGENT_START_TIME, new org.apache.thrift.meta_data.FieldMetaData("agentStartTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.SERVICE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("serviceType", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.TRANSACTION_ID, new org.apache.thrift.meta_data.FieldMetaData("transactionId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.SPAN_ID, new org.apache.thrift.meta_data.FieldMetaData("spanId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.END_POINT, new org.apache.thrift.meta_data.FieldMetaData("endPoint", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SPAN_EVENT_LIST, new org.apache.thrift.meta_data.FieldMetaData("spanEventList", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TSpanEvent.class))));
    tmpMap.put(_Fields.APPLICATION_SERVICE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("applicationServiceType", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.KEY_TIME, new org.apache.thrift.meta_data.FieldMetaData("keyTime", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
    tmpMap.put(_Fields.LOCAL_ASYNC_ID, new org.apache.thrift.meta_data.FieldMetaData("localAsyncId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TLocalAsyncId.class)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSpanChunk.class, metaDataMap);
  }

  public TSpanChunk() {
    this.version = (byte)1;

  }

  public TSpanChunk(
    java.lang.String agentId,
    java.lang.String applicationName,
    long agentStartTime,
    short serviceType,
    java.nio.ByteBuffer transactionId,
    long spanId,
    java.util.List<TSpanEvent> spanEventList)
  {
    this();
    this.agentId = agentId;
    this.applicationName = applicationName;
    this.agentStartTime = agentStartTime;
    setAgentStartTimeIsSet(true);
    this.serviceType = serviceType;
    setServiceTypeIsSet(true);
    this.transactionId = org.apache.thrift.TBaseHelper.copyBinary(transactionId);
    this.spanId = spanId;
    setSpanIdIsSet(true);
    this.spanEventList = spanEventList;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TSpanChunk(TSpanChunk other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetAgentId()) {
      this.agentId = other.agentId;
    }
    if (other.isSetApplicationName()) {
      this.applicationName = other.applicationName;
    }
    this.agentStartTime = other.agentStartTime;
    this.serviceType = other.serviceType;
    if (other.isSetTransactionId()) {
      this.transactionId = org.apache.thrift.TBaseHelper.copyBinary(other.transactionId);
    }
    this.spanId = other.spanId;
    if (other.isSetEndPoint()) {
      this.endPoint = other.endPoint;
    }
    if (other.isSetSpanEventList()) {
      java.util.List<TSpanEvent> __this__spanEventList = new java.util.ArrayList<TSpanEvent>(other.spanEventList.size());
      for (TSpanEvent other_element : other.spanEventList) {
        __this__spanEventList.add(new TSpanEvent(other_element));
      }
      this.spanEventList = __this__spanEventList;
    }
    this.applicationServiceType = other.applicationServiceType;
    this.keyTime = other.keyTime;
    this.version = other.version;
    if (other.isSetLocalAsyncId()) {
      this.localAsyncId = new TLocalAsyncId(other.localAsyncId);
    }
  }

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

  @Override
  public void clear() {
    this.agentId = null;
    this.applicationName = null;
    setAgentStartTimeIsSet(false);
    this.agentStartTime = 0;
    setServiceTypeIsSet(false);
    this.serviceType = 0;
    this.transactionId = null;
    setSpanIdIsSet(false);
    this.spanId = 0;
    this.endPoint = null;
    this.spanEventList = null;
    setApplicationServiceTypeIsSet(false);
    this.applicationServiceType = 0;
    setKeyTimeIsSet(false);
    this.keyTime = 0;
    this.version = (byte)1;

    this.localAsyncId = null;
  }

  public java.lang.String getAgentId() {
    return this.agentId;
  }

  public void setAgentId(java.lang.String agentId) {
    this.agentId = agentId;
  }

  public void unsetAgentId() {
    this.agentId = null;
  }

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

  public void setAgentIdIsSet(boolean value) {
    if (!value) {
      this.agentId = null;
    }
  }

  public java.lang.String getApplicationName() {
    return this.applicationName;
  }

  public void setApplicationName(java.lang.String applicationName) {
    this.applicationName = applicationName;
  }

  public void unsetApplicationName() {
    this.applicationName = null;
  }

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

  public void setApplicationNameIsSet(boolean value) {
    if (!value) {
      this.applicationName = null;
    }
  }

  public long getAgentStartTime() {
    return this.agentStartTime;
  }

  public void setAgentStartTime(long agentStartTime) {
    this.agentStartTime = agentStartTime;
    setAgentStartTimeIsSet(true);
  }

  public void unsetAgentStartTime() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __AGENTSTARTTIME_ISSET_ID);
  }

  /** Returns true if field agentStartTime is set (has been assigned a value) and false otherwise */
  public boolean isSetAgentStartTime() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __AGENTSTARTTIME_ISSET_ID);
  }

  public void setAgentStartTimeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __AGENTSTARTTIME_ISSET_ID, value);
  }

  @Deprecated
  public short getServiceType() {
    return this.serviceType;
  }

  @Deprecated
  public void setServiceType(short serviceType) {
    this.serviceType = serviceType;
    setServiceTypeIsSet(true);
  }

  @Deprecated
  public void unsetServiceType() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SERVICETYPE_ISSET_ID);
  }

  /** Returns true if field serviceType is set (has been assigned a value) and false otherwise */
  @Deprecated
  public boolean isSetServiceType() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SERVICETYPE_ISSET_ID);
  }

  @Deprecated
  public void setServiceTypeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SERVICETYPE_ISSET_ID, value);
  }

  public byte[] getTransactionId() {
    setTransactionId(org.apache.thrift.TBaseHelper.rightSize(transactionId));
    return transactionId == null ? null : transactionId.array();
  }

  public java.nio.ByteBuffer bufferForTransactionId() {
    return org.apache.thrift.TBaseHelper.copyBinary(transactionId);
  }

  public void setTransactionId(byte[] transactionId) {
    this.transactionId = transactionId == null ? (java.nio.ByteBuffer)null : java.nio.ByteBuffer.wrap(transactionId.clone());
  }

  public void setTransactionId(java.nio.ByteBuffer transactionId) {
    this.transactionId = org.apache.thrift.TBaseHelper.copyBinary(transactionId);
  }

  public void unsetTransactionId() {
    this.transactionId = null;
  }

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

  public void setTransactionIdIsSet(boolean value) {
    if (!value) {
      this.transactionId = null;
    }
  }

  public long getSpanId() {
    return this.spanId;
  }

  public void setSpanId(long spanId) {
    this.spanId = spanId;
    setSpanIdIsSet(true);
  }

  public void unsetSpanId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __SPANID_ISSET_ID);
  }

  /** Returns true if field spanId is set (has been assigned a value) and false otherwise */
  public boolean isSetSpanId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SPANID_ISSET_ID);
  }

  public void setSpanIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SPANID_ISSET_ID, value);
  }

  public java.lang.String getEndPoint() {
    return this.endPoint;
  }

  public void setEndPoint(java.lang.String endPoint) {
    this.endPoint = endPoint;
  }

  public void unsetEndPoint() {
    this.endPoint = null;
  }

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

  public void setEndPointIsSet(boolean value) {
    if (!value) {
      this.endPoint = null;
    }
  }

  public int getSpanEventListSize() {
    return (this.spanEventList == null) ? 0 : this.spanEventList.size();
  }

  public java.util.Iterator<TSpanEvent> getSpanEventListIterator() {
    return (this.spanEventList == null) ? null : this.spanEventList.iterator();
  }

  public void addToSpanEventList(TSpanEvent elem) {
    if (this.spanEventList == null) {
      this.spanEventList = new java.util.ArrayList<TSpanEvent>();
    }
    this.spanEventList.add(elem);
  }

  public java.util.List<TSpanEvent> getSpanEventList() {
    return this.spanEventList;
  }

  public void setSpanEventList(java.util.List<TSpanEvent> spanEventList) {
    this.spanEventList = spanEventList;
  }

  public void unsetSpanEventList() {
    this.spanEventList = null;
  }

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

  public void setSpanEventListIsSet(boolean value) {
    if (!value) {
      this.spanEventList = null;
    }
  }

  public short getApplicationServiceType() {
    return this.applicationServiceType;
  }

  public void setApplicationServiceType(short applicationServiceType) {
    this.applicationServiceType = applicationServiceType;
    setApplicationServiceTypeIsSet(true);
  }

  public void unsetApplicationServiceType() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __APPLICATIONSERVICETYPE_ISSET_ID);
  }

  /** Returns true if field applicationServiceType is set (has been assigned a value) and false otherwise */
  public boolean isSetApplicationServiceType() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __APPLICATIONSERVICETYPE_ISSET_ID);
  }

  public void setApplicationServiceTypeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __APPLICATIONSERVICETYPE_ISSET_ID, value);
  }

  public long getKeyTime() {
    return this.keyTime;
  }

  public void setKeyTime(long keyTime) {
    this.keyTime = keyTime;
    setKeyTimeIsSet(true);
  }

  public void unsetKeyTime() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __KEYTIME_ISSET_ID);
  }

  /** Returns true if field keyTime is set (has been assigned a value) and false otherwise */
  public boolean isSetKeyTime() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __KEYTIME_ISSET_ID);
  }

  public void setKeyTimeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __KEYTIME_ISSET_ID, value);
  }

  public byte getVersion() {
    return this.version;
  }

  public void setVersion(byte version) {
    this.version = version;
    setVersionIsSet(true);
  }

  public void unsetVersion() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID);
  }

  /** Returns true if field version is set (has been assigned a value) and false otherwise */
  public boolean isSetVersion() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
  }

  public void setVersionIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value);
  }

  public TLocalAsyncId getLocalAsyncId() {
    return this.localAsyncId;
  }

  public void setLocalAsyncId(TLocalAsyncId localAsyncId) {
    this.localAsyncId = localAsyncId;
  }

  public void unsetLocalAsyncId() {
    this.localAsyncId = null;
  }

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

  public void setLocalAsyncIdIsSet(boolean value) {
    if (!value) {
      this.localAsyncId = null;
    }
  }

  public void setFieldValue(_Fields field, java.lang.Object value) {
    switch (field) {
    case AGENT_ID:
      if (value == null) {
        unsetAgentId();
      } else {
        setAgentId((java.lang.String)value);
      }
      break;

    case APPLICATION_NAME:
      if (value == null) {
        unsetApplicationName();
      } else {
        setApplicationName((java.lang.String)value);
      }
      break;

    case AGENT_START_TIME:
      if (value == null) {
        unsetAgentStartTime();
      } else {
        setAgentStartTime((java.lang.Long)value);
      }
      break;

    case SERVICE_TYPE:
      if (value == null) {
        unsetServiceType();
      } else {
        setServiceType((java.lang.Short)value);
      }
      break;

    case TRANSACTION_ID:
      if (value == null) {
        unsetTransactionId();
      } else {
        if (value instanceof byte[]) {
          setTransactionId((byte[])value);
        } else {
          setTransactionId((java.nio.ByteBuffer)value);
        }
      }
      break;

    case SPAN_ID:
      if (value == null) {
        unsetSpanId();
      } else {
        setSpanId((java.lang.Long)value);
      }
      break;

    case END_POINT:
      if (value == null) {
        unsetEndPoint();
      } else {
        setEndPoint((java.lang.String)value);
      }
      break;

    case SPAN_EVENT_LIST:
      if (value == null) {
        unsetSpanEventList();
      } else {
        setSpanEventList((java.util.List<TSpanEvent>)value);
      }
      break;

    case APPLICATION_SERVICE_TYPE:
      if (value == null) {
        unsetApplicationServiceType();
      } else {
        setApplicationServiceType((java.lang.Short)value);
      }
      break;

    case KEY_TIME:
      if (value == null) {
        unsetKeyTime();
      } else {
        setKeyTime((java.lang.Long)value);
      }
      break;

    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((java.lang.Byte)value);
      }
      break;

    case LOCAL_ASYNC_ID:
      if (value == null) {
        unsetLocalAsyncId();
      } else {
        setLocalAsyncId((TLocalAsyncId)value);
      }
      break;

    }
  }

  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case AGENT_ID:
      return getAgentId();

    case APPLICATION_NAME:
      return getApplicationName();

    case AGENT_START_TIME:
      return getAgentStartTime();

    case SERVICE_TYPE:
      return getServiceType();

    case TRANSACTION_ID:
      return getTransactionId();

    case SPAN_ID:
      return getSpanId();

    case END_POINT:
      return getEndPoint();

    case SPAN_EVENT_LIST:
      return getSpanEventList();

    case APPLICATION_SERVICE_TYPE:
      return getApplicationServiceType();

    case KEY_TIME:
      return getKeyTime();

    case VERSION:
      return getVersion();

    case LOCAL_ASYNC_ID:
      return getLocalAsyncId();

    }
    throw new java.lang.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 java.lang.IllegalArgumentException();
    }

    switch (field) {
    case AGENT_ID:
      return isSetAgentId();
    case APPLICATION_NAME:
      return isSetApplicationName();
    case AGENT_START_TIME:
      return isSetAgentStartTime();
    case SERVICE_TYPE:
      return isSetServiceType();
    case TRANSACTION_ID:
      return isSetTransactionId();
    case SPAN_ID:
      return isSetSpanId();
    case END_POINT:
      return isSetEndPoint();
    case SPAN_EVENT_LIST:
      return isSetSpanEventList();
    case APPLICATION_SERVICE_TYPE:
      return isSetApplicationServiceType();
    case KEY_TIME:
      return isSetKeyTime();
    case VERSION:
      return isSetVersion();
    case LOCAL_ASYNC_ID:
      return isSetLocalAsyncId();
    }
    throw new java.lang.IllegalStateException();
  }

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

  public boolean equals(TSpanChunk that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_agentId = true && this.isSetAgentId();
    boolean that_present_agentId = true && that.isSetAgentId();
    if (this_present_agentId || that_present_agentId) {
      if (!(this_present_agentId && that_present_agentId))
        return false;
      if (!this.agentId.equals(that.agentId))
        return false;
    }

    boolean this_present_applicationName = true && this.isSetApplicationName();
    boolean that_present_applicationName = true && that.isSetApplicationName();
    if (this_present_applicationName || that_present_applicationName) {
      if (!(this_present_applicationName && that_present_applicationName))
        return false;
      if (!this.applicationName.equals(that.applicationName))
        return false;
    }

    boolean this_present_agentStartTime = true;
    boolean that_present_agentStartTime = true;
    if (this_present_agentStartTime || that_present_agentStartTime) {
      if (!(this_present_agentStartTime && that_present_agentStartTime))
        return false;
      if (this.agentStartTime != that.agentStartTime)
        return false;
    }

    boolean this_present_serviceType = true;
    boolean that_present_serviceType = true;
    if (this_present_serviceType || that_present_serviceType) {
      if (!(this_present_serviceType && that_present_serviceType))
        return false;
      if (this.serviceType != that.serviceType)
        return false;
    }

    boolean this_present_transactionId = true && this.isSetTransactionId();
    boolean that_present_transactionId = true && that.isSetTransactionId();
    if (this_present_transactionId || that_present_transactionId) {
      if (!(this_present_transactionId && that_present_transactionId))
        return false;
      if (!this.transactionId.equals(that.transactionId))
        return false;
    }

    boolean this_present_spanId = true;
    boolean that_present_spanId = true;
    if (this_present_spanId || that_present_spanId) {
      if (!(this_present_spanId && that_present_spanId))
        return false;
      if (this.spanId != that.spanId)
        return false;
    }

    boolean this_present_endPoint = true && this.isSetEndPoint();
    boolean that_present_endPoint = true && that.isSetEndPoint();
    if (this_present_endPoint || that_present_endPoint) {
      if (!(this_present_endPoint && that_present_endPoint))
        return false;
      if (!this.endPoint.equals(that.endPoint))
        return false;
    }

    boolean this_present_spanEventList = true && this.isSetSpanEventList();
    boolean that_present_spanEventList = true && that.isSetSpanEventList();
    if (this_present_spanEventList || that_present_spanEventList) {
      if (!(this_present_spanEventList && that_present_spanEventList))
        return false;
      if (!this.spanEventList.equals(that.spanEventList))
        return false;
    }

    boolean this_present_applicationServiceType = true && this.isSetApplicationServiceType();
    boolean that_present_applicationServiceType = true && that.isSetApplicationServiceType();
    if (this_present_applicationServiceType || that_present_applicationServiceType) {
      if (!(this_present_applicationServiceType && that_present_applicationServiceType))
        return false;
      if (this.applicationServiceType != that.applicationServiceType)
        return false;
    }

    boolean this_present_keyTime = true && this.isSetKeyTime();
    boolean that_present_keyTime = true && that.isSetKeyTime();
    if (this_present_keyTime || that_present_keyTime) {
      if (!(this_present_keyTime && that_present_keyTime))
        return false;
      if (this.keyTime != that.keyTime)
        return false;
    }

    boolean this_present_version = true && this.isSetVersion();
    boolean that_present_version = true && that.isSetVersion();
    if (this_present_version || that_present_version) {
      if (!(this_present_version && that_present_version))
        return false;
      if (this.version != that.version)
        return false;
    }

    boolean this_present_localAsyncId = true && this.isSetLocalAsyncId();
    boolean that_present_localAsyncId = true && that.isSetLocalAsyncId();
    if (this_present_localAsyncId || that_present_localAsyncId) {
      if (!(this_present_localAsyncId && that_present_localAsyncId))
        return false;
      if (!this.localAsyncId.equals(that.localAsyncId))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetAgentId()) ? 131071 : 524287);
    if (isSetAgentId())
      hashCode = hashCode * 8191 + agentId.hashCode();

    hashCode = hashCode * 8191 + ((isSetApplicationName()) ? 131071 : 524287);
    if (isSetApplicationName())
      hashCode = hashCode * 8191 + applicationName.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(agentStartTime);

    hashCode = hashCode * 8191 + serviceType;

    hashCode = hashCode * 8191 + ((isSetTransactionId()) ? 131071 : 524287);
    if (isSetTransactionId())
      hashCode = hashCode * 8191 + transactionId.hashCode();

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(spanId);

    hashCode = hashCode * 8191 + ((isSetEndPoint()) ? 131071 : 524287);
    if (isSetEndPoint())
      hashCode = hashCode * 8191 + endPoint.hashCode();

    hashCode = hashCode * 8191 + ((isSetSpanEventList()) ? 131071 : 524287);
    if (isSetSpanEventList())
      hashCode = hashCode * 8191 + spanEventList.hashCode();

    hashCode = hashCode * 8191 + ((isSetApplicationServiceType()) ? 131071 : 524287);
    if (isSetApplicationServiceType())
      hashCode = hashCode * 8191 + applicationServiceType;

    hashCode = hashCode * 8191 + ((isSetKeyTime()) ? 131071 : 524287);
    if (isSetKeyTime())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(keyTime);

    hashCode = hashCode * 8191 + ((isSetVersion()) ? 131071 : 524287);
    if (isSetVersion())
      hashCode = hashCode * 8191 + (int) (version);

    hashCode = hashCode * 8191 + ((isSetLocalAsyncId()) ? 131071 : 524287);
    if (isSetLocalAsyncId())
      hashCode = hashCode * 8191 + localAsyncId.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetAgentId()).compareTo(other.isSetAgentId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAgentId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.agentId, other.agentId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetApplicationName()).compareTo(other.isSetApplicationName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApplicationName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationName, other.applicationName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetAgentStartTime()).compareTo(other.isSetAgentStartTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAgentStartTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.agentStartTime, other.agentStartTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetServiceType()).compareTo(other.isSetServiceType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetServiceType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.serviceType, other.serviceType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetTransactionId()).compareTo(other.isSetTransactionId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTransactionId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.transactionId, other.transactionId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetSpanId()).compareTo(other.isSetSpanId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpanId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spanId, other.spanId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetEndPoint()).compareTo(other.isSetEndPoint());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEndPoint()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endPoint, other.endPoint);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetSpanEventList()).compareTo(other.isSetSpanEventList());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSpanEventList()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spanEventList, other.spanEventList);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetApplicationServiceType()).compareTo(other.isSetApplicationServiceType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApplicationServiceType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.applicationServiceType, other.applicationServiceType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetKeyTime()).compareTo(other.isSetKeyTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetKeyTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.keyTime, other.keyTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetVersion()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetLocalAsyncId()).compareTo(other.isSetLocalAsyncId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLocalAsyncId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.localAsyncId, other.localAsyncId);
      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 {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TSpanChunk(");
    boolean first = true;

    sb.append("agentId:");
    if (this.agentId == null) {
      sb.append("null");
    } else {
      sb.append(this.agentId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("applicationName:");
    if (this.applicationName == null) {
      sb.append("null");
    } else {
      sb.append(this.applicationName);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("agentStartTime:");
    sb.append(this.agentStartTime);
    first = false;
    if (!first) sb.append(", ");
    sb.append("serviceType:");
    sb.append(this.serviceType);
    first = false;
    if (!first) sb.append(", ");
    sb.append("transactionId:");
    if (this.transactionId == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.transactionId, sb);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("spanId:");
    sb.append(this.spanId);
    first = false;
    if (isSetEndPoint()) {
      if (!first) sb.append(", ");
      sb.append("endPoint:");
      if (this.endPoint == null) {
        sb.append("null");
      } else {
        sb.append(this.endPoint);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("spanEventList:");
    if (this.spanEventList == null) {
      sb.append("null");
    } else {
      sb.append(this.spanEventList);
    }
    first = false;
    if (isSetApplicationServiceType()) {
      if (!first) sb.append(", ");
      sb.append("applicationServiceType:");
      sb.append(this.applicationServiceType);
      first = false;
    }
    if (isSetKeyTime()) {
      if (!first) sb.append(", ");
      sb.append("keyTime:");
      sb.append(this.keyTime);
      first = false;
    }
    if (isSetVersion()) {
      if (!first) sb.append(", ");
      sb.append("version:");
      sb.append(this.version);
      first = false;
    }
    if (isSetLocalAsyncId()) {
      if (!first) sb.append(", ");
      sb.append("localAsyncId:");
      if (this.localAsyncId == null) {
        sb.append("null");
      } else {
        sb.append(this.localAsyncId);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
    if (localAsyncId != null) {
      localAsyncId.validate();
    }
  }

  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, java.lang.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 TSpanChunkStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSpanChunkStandardScheme getScheme() {
      return new TSpanChunkStandardScheme();
    }
  }

  private static class TSpanChunkStandardScheme extends org.apache.thrift.scheme.StandardScheme<TSpanChunk> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSpanChunk 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: // AGENT_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.agentId = iprot.readString();
              struct.setAgentIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // APPLICATION_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.applicationName = iprot.readString();
              struct.setApplicationNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // AGENT_START_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.agentStartTime = iprot.readI64();
              struct.setAgentStartTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // SERVICE_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.serviceType = iprot.readI16();
              struct.setServiceTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // TRANSACTION_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.transactionId = iprot.readBinary();
              struct.setTransactionIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // SPAN_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.spanId = iprot.readI64();
              struct.setSpanIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // END_POINT
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.endPoint = iprot.readString();
              struct.setEndPointIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // SPAN_EVENT_LIST
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
                struct.spanEventList = new java.util.ArrayList<TSpanEvent>(_list24.size);
                TSpanEvent _elem25;
                for (int _i26 = 0; _i26 < _list24.size; ++_i26)
                {
                  _elem25 = new TSpanEvent();
                  _elem25.read(iprot);
                  struct.spanEventList.add(_elem25);
                }
                iprot.readListEnd();
              }
              struct.setSpanEventListIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // APPLICATION_SERVICE_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.applicationServiceType = iprot.readI16();
              struct.setApplicationServiceTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // KEY_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.keyTime = iprot.readI64();
              struct.setKeyTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // VERSION
            if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
              struct.version = iprot.readByte();
              struct.setVersionIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // LOCAL_ASYNC_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.localAsyncId = new TLocalAsyncId();
              struct.localAsyncId.read(iprot);
              struct.setLocalAsyncIdIsSet(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();
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.agentId != null) {
        oprot.writeFieldBegin(AGENT_ID_FIELD_DESC);
        oprot.writeString(struct.agentId);
        oprot.writeFieldEnd();
      }
      if (struct.applicationName != null) {
        oprot.writeFieldBegin(APPLICATION_NAME_FIELD_DESC);
        oprot.writeString(struct.applicationName);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(AGENT_START_TIME_FIELD_DESC);
      oprot.writeI64(struct.agentStartTime);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(SERVICE_TYPE_FIELD_DESC);
      oprot.writeI16(struct.serviceType);
      oprot.writeFieldEnd();
      if (struct.transactionId != null) {
        oprot.writeFieldBegin(TRANSACTION_ID_FIELD_DESC);
        oprot.writeBinary(struct.transactionId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(SPAN_ID_FIELD_DESC);
      oprot.writeI64(struct.spanId);
      oprot.writeFieldEnd();
      if (struct.endPoint != null) {
        if (struct.isSetEndPoint()) {
          oprot.writeFieldBegin(END_POINT_FIELD_DESC);
          oprot.writeString(struct.endPoint);
          oprot.writeFieldEnd();
        }
      }
      if (struct.spanEventList != null) {
        oprot.writeFieldBegin(SPAN_EVENT_LIST_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.spanEventList.size()));
          for (TSpanEvent _iter27 : struct.spanEventList)
          {
            _iter27.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.isSetApplicationServiceType()) {
        oprot.writeFieldBegin(APPLICATION_SERVICE_TYPE_FIELD_DESC);
        oprot.writeI16(struct.applicationServiceType);
        oprot.writeFieldEnd();
      }
      if (struct.isSetKeyTime()) {
        oprot.writeFieldBegin(KEY_TIME_FIELD_DESC);
        oprot.writeI64(struct.keyTime);
        oprot.writeFieldEnd();
      }
      if (struct.isSetVersion()) {
        oprot.writeFieldBegin(VERSION_FIELD_DESC);
        oprot.writeByte(struct.version);
        oprot.writeFieldEnd();
      }
      if (struct.localAsyncId != null) {
        if (struct.isSetLocalAsyncId()) {
          oprot.writeFieldBegin(LOCAL_ASYNC_ID_FIELD_DESC);
          struct.localAsyncId.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TSpanChunkTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSpanChunkTupleScheme getScheme() {
      return new TSpanChunkTupleScheme();
    }
  }

  private static class TSpanChunkTupleScheme extends org.apache.thrift.scheme.TupleScheme<TSpanChunk> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSpanChunk struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetAgentId()) {
        optionals.set(0);
      }
      if (struct.isSetApplicationName()) {
        optionals.set(1);
      }
      if (struct.isSetAgentStartTime()) {
        optionals.set(2);
      }
      if (struct.isSetServiceType()) {
        optionals.set(3);
      }
      if (struct.isSetTransactionId()) {
        optionals.set(4);
      }
      if (struct.isSetSpanId()) {
        optionals.set(5);
      }
      if (struct.isSetEndPoint()) {
        optionals.set(6);
      }
      if (struct.isSetSpanEventList()) {
        optionals.set(7);
      }
      if (struct.isSetApplicationServiceType()) {
        optionals.set(8);
      }
      if (struct.isSetKeyTime()) {
        optionals.set(9);
      }
      if (struct.isSetVersion()) {
        optionals.set(10);
      }
      if (struct.isSetLocalAsyncId()) {
        optionals.set(11);
      }
      oprot.writeBitSet(optionals, 12);
      if (struct.isSetAgentId()) {
        oprot.writeString(struct.agentId);
      }
      if (struct.isSetApplicationName()) {
        oprot.writeString(struct.applicationName);
      }
      if (struct.isSetAgentStartTime()) {
        oprot.writeI64(struct.agentStartTime);
      }
      if (struct.isSetServiceType()) {
        oprot.writeI16(struct.serviceType);
      }
      if (struct.isSetTransactionId()) {
        oprot.writeBinary(struct.transactionId);
      }
      if (struct.isSetSpanId()) {
        oprot.writeI64(struct.spanId);
      }
      if (struct.isSetEndPoint()) {
        oprot.writeString(struct.endPoint);
      }
      if (struct.isSetSpanEventList()) {
        {
          oprot.writeI32(struct.spanEventList.size());
          for (TSpanEvent _iter28 : struct.spanEventList)
          {
            _iter28.write(oprot);
          }
        }
      }
      if (struct.isSetApplicationServiceType()) {
        oprot.writeI16(struct.applicationServiceType);
      }
      if (struct.isSetKeyTime()) {
        oprot.writeI64(struct.keyTime);
      }
      if (struct.isSetVersion()) {
        oprot.writeByte(struct.version);
      }
      if (struct.isSetLocalAsyncId()) {
        struct.localAsyncId.write(oprot);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSpanChunk struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(12);
      if (incoming.get(0)) {
        struct.agentId = iprot.readString();
        struct.setAgentIdIsSet(true);
      }
      if (incoming.get(1)) {
        struct.applicationName = iprot.readString();
        struct.setApplicationNameIsSet(true);
      }
      if (incoming.get(2)) {
        struct.agentStartTime = iprot.readI64();
        struct.setAgentStartTimeIsSet(true);
      }
      if (incoming.get(3)) {
        struct.serviceType = iprot.readI16();
        struct.setServiceTypeIsSet(true);
      }
      if (incoming.get(4)) {
        struct.transactionId = iprot.readBinary();
        struct.setTransactionIdIsSet(true);
      }
      if (incoming.get(5)) {
        struct.spanId = iprot.readI64();
        struct.setSpanIdIsSet(true);
      }
      if (incoming.get(6)) {
        struct.endPoint = iprot.readString();
        struct.setEndPointIsSet(true);
      }
      if (incoming.get(7)) {
        {
          org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.spanEventList = new java.util.ArrayList<TSpanEvent>(_list29.size);
          TSpanEvent _elem30;
          for (int _i31 = 0; _i31 < _list29.size; ++_i31)
          {
            _elem30 = new TSpanEvent();
            _elem30.read(iprot);
            struct.spanEventList.add(_elem30);
          }
        }
        struct.setSpanEventListIsSet(true);
      }
      if (incoming.get(8)) {
        struct.applicationServiceType = iprot.readI16();
        struct.setApplicationServiceTypeIsSet(true);
      }
      if (incoming.get(9)) {
        struct.keyTime = iprot.readI64();
        struct.setKeyTimeIsSet(true);
      }
      if (incoming.get(10)) {
        struct.version = iprot.readByte();
        struct.setVersionIsSet(true);
      }
      if (incoming.get(11)) {
        struct.localAsyncId = new TLocalAsyncId();
        struct.localAsyncId.read(iprot);
        struct.setLocalAsyncIdIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

