/**
 * 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 = "2017-03-21")
public class TSpan implements org.apache.thrift.TBase<TSpan, TSpan._Fields>, java.io.Serializable, Cloneable, Comparable<TSpan> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TSpan");

  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 TRANSACTION_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("transactionId", org.apache.thrift.protocol.TType.STRING, (short)4);
  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)7);
  private static final org.apache.thrift.protocol.TField PARENT_SPAN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("parentSpanId", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField START_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("startTime", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField ELAPSED_FIELD_DESC = new org.apache.thrift.protocol.TField("elapsed", org.apache.thrift.protocol.TType.I32, (short)10);
  private static final org.apache.thrift.protocol.TField RPC_FIELD_DESC = new org.apache.thrift.protocol.TField("rpc", org.apache.thrift.protocol.TType.STRING, (short)11);
  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)12);
  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)13);
  private static final org.apache.thrift.protocol.TField REMOTE_ADDR_FIELD_DESC = new org.apache.thrift.protocol.TField("remoteAddr", org.apache.thrift.protocol.TType.STRING, (short)14);
  private static final org.apache.thrift.protocol.TField ANNOTATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("annotations", org.apache.thrift.protocol.TType.LIST, (short)15);
  private static final org.apache.thrift.protocol.TField FLAG_FIELD_DESC = new org.apache.thrift.protocol.TField("flag", org.apache.thrift.protocol.TType.I16, (short)16);
  private static final org.apache.thrift.protocol.TField ERR_FIELD_DESC = new org.apache.thrift.protocol.TField("err", org.apache.thrift.protocol.TType.I32, (short)17);
  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)18);
  private static final org.apache.thrift.protocol.TField PARENT_APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("parentApplicationName", org.apache.thrift.protocol.TType.STRING, (short)19);
  private static final org.apache.thrift.protocol.TField PARENT_APPLICATION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("parentApplicationType", org.apache.thrift.protocol.TType.I16, (short)20);
  private static final org.apache.thrift.protocol.TField ACCEPTOR_HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("acceptorHost", org.apache.thrift.protocol.TType.STRING, (short)21);
  private static final org.apache.thrift.protocol.TField API_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("apiId", org.apache.thrift.protocol.TType.I32, (short)25);
  private static final org.apache.thrift.protocol.TField EXCEPTION_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("exceptionInfo", org.apache.thrift.protocol.TType.STRUCT, (short)26);
  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)30);
  private static final org.apache.thrift.protocol.TField LOGGING_TRANSACTION_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("loggingTransactionInfo", org.apache.thrift.protocol.TType.BYTE, (short)31);
  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)32);

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

  private java.lang.String agentId; // required
  private java.lang.String applicationName; // required
  private long agentStartTime; // required
  private java.nio.ByteBuffer transactionId; // required
  private long spanId; // required
  private long parentSpanId; // optional
  private long startTime; // required
  private int elapsed; // optional
  private java.lang.String rpc; // optional
  private short serviceType; // required
  private java.lang.String endPoint; // optional
  private java.lang.String remoteAddr; // optional
  private java.util.List<TAnnotation> annotations; // optional
  private short flag; // optional
  private int err; // optional
  private java.util.List<TSpanEvent> spanEventList; // optional
  private java.lang.String parentApplicationName; // optional
  private short parentApplicationType; // optional
  private java.lang.String acceptorHost; // optional
  private int apiId; // optional
  private TIntStringValue exceptionInfo; // optional
  private short applicationServiceType; // optional
  private byte loggingTransactionInfo; // optional
  private byte version; // 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"),
    TRANSACTION_ID((short)4, "transactionId"),
    SPAN_ID((short)7, "spanId"),
    PARENT_SPAN_ID((short)8, "parentSpanId"),
    START_TIME((short)9, "startTime"),
    ELAPSED((short)10, "elapsed"),
    RPC((short)11, "rpc"),
    SERVICE_TYPE((short)12, "serviceType"),
    END_POINT((short)13, "endPoint"),
    REMOTE_ADDR((short)14, "remoteAddr"),
    ANNOTATIONS((short)15, "annotations"),
    FLAG((short)16, "flag"),
    ERR((short)17, "err"),
    SPAN_EVENT_LIST((short)18, "spanEventList"),
    PARENT_APPLICATION_NAME((short)19, "parentApplicationName"),
    PARENT_APPLICATION_TYPE((short)20, "parentApplicationType"),
    ACCEPTOR_HOST((short)21, "acceptorHost"),
    API_ID((short)25, "apiId"),
    EXCEPTION_INFO((short)26, "exceptionInfo"),
    APPLICATION_SERVICE_TYPE((short)30, "applicationServiceType"),
    LOGGING_TRANSACTION_INFO((short)31, "loggingTransactionInfo"),
    VERSION((short)32, "version");

    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: // TRANSACTION_ID
          return TRANSACTION_ID;
        case 7: // SPAN_ID
          return SPAN_ID;
        case 8: // PARENT_SPAN_ID
          return PARENT_SPAN_ID;
        case 9: // START_TIME
          return START_TIME;
        case 10: // ELAPSED
          return ELAPSED;
        case 11: // RPC
          return RPC;
        case 12: // SERVICE_TYPE
          return SERVICE_TYPE;
        case 13: // END_POINT
          return END_POINT;
        case 14: // REMOTE_ADDR
          return REMOTE_ADDR;
        case 15: // ANNOTATIONS
          return ANNOTATIONS;
        case 16: // FLAG
          return FLAG;
        case 17: // ERR
          return ERR;
        case 18: // SPAN_EVENT_LIST
          return SPAN_EVENT_LIST;
        case 19: // PARENT_APPLICATION_NAME
          return PARENT_APPLICATION_NAME;
        case 20: // PARENT_APPLICATION_TYPE
          return PARENT_APPLICATION_TYPE;
        case 21: // ACCEPTOR_HOST
          return ACCEPTOR_HOST;
        case 25: // API_ID
          return API_ID;
        case 26: // EXCEPTION_INFO
          return EXCEPTION_INFO;
        case 30: // APPLICATION_SERVICE_TYPE
          return APPLICATION_SERVICE_TYPE;
        case 31: // LOGGING_TRANSACTION_INFO
          return LOGGING_TRANSACTION_INFO;
        case 32: // VERSION
          return VERSION;
        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 __SPANID_ISSET_ID = 1;
  private static final int __PARENTSPANID_ISSET_ID = 2;
  private static final int __STARTTIME_ISSET_ID = 3;
  private static final int __ELAPSED_ISSET_ID = 4;
  private static final int __SERVICETYPE_ISSET_ID = 5;
  private static final int __FLAG_ISSET_ID = 6;
  private static final int __ERR_ISSET_ID = 7;
  private static final int __PARENTAPPLICATIONTYPE_ISSET_ID = 8;
  private static final int __APIID_ISSET_ID = 9;
  private static final int __APPLICATIONSERVICETYPE_ISSET_ID = 10;
  private static final int __LOGGINGTRANSACTIONINFO_ISSET_ID = 11;
  private static final int __VERSION_ISSET_ID = 12;
  private short __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.PARENT_SPAN_ID,_Fields.ELAPSED,_Fields.RPC,_Fields.END_POINT,_Fields.REMOTE_ADDR,_Fields.ANNOTATIONS,_Fields.FLAG,_Fields.ERR,_Fields.SPAN_EVENT_LIST,_Fields.PARENT_APPLICATION_NAME,_Fields.PARENT_APPLICATION_TYPE,_Fields.ACCEPTOR_HOST,_Fields.API_ID,_Fields.EXCEPTION_INFO,_Fields.APPLICATION_SERVICE_TYPE,_Fields.LOGGING_TRANSACTION_INFO,_Fields.VERSION};
  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.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.PARENT_SPAN_ID, new org.apache.thrift.meta_data.FieldMetaData("parentSpanId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.START_TIME, new org.apache.thrift.meta_data.FieldMetaData("startTime", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ELAPSED, new org.apache.thrift.meta_data.FieldMetaData("elapsed", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.RPC, new org.apache.thrift.meta_data.FieldMetaData("rpc", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    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.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.REMOTE_ADDR, new org.apache.thrift.meta_data.FieldMetaData("remoteAddr", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ANNOTATIONS, new org.apache.thrift.meta_data.FieldMetaData("annotations", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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, TAnnotation.class))));
    tmpMap.put(_Fields.FLAG, new org.apache.thrift.meta_data.FieldMetaData("flag", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.ERR, new org.apache.thrift.meta_data.FieldMetaData("err", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.SPAN_EVENT_LIST, new org.apache.thrift.meta_data.FieldMetaData("spanEventList", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        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.PARENT_APPLICATION_NAME, new org.apache.thrift.meta_data.FieldMetaData("parentApplicationName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PARENT_APPLICATION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("parentApplicationType", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
    tmpMap.put(_Fields.ACCEPTOR_HOST, new org.apache.thrift.meta_data.FieldMetaData("acceptorHost", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.API_ID, new org.apache.thrift.meta_data.FieldMetaData("apiId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.EXCEPTION_INFO, new org.apache.thrift.meta_data.FieldMetaData("exceptionInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TIntStringValue.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.LOGGING_TRANSACTION_INFO, new org.apache.thrift.meta_data.FieldMetaData("loggingTransactionInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
    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)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TSpan.class, metaDataMap);
  }

  public TSpan() {
    this.parentSpanId = -1L;

    this.elapsed = 0;

    this.flag = (short)0;

    this.version = (byte)1;

  }

  public TSpan(
    java.lang.String agentId,
    java.lang.String applicationName,
    long agentStartTime,
    java.nio.ByteBuffer transactionId,
    long spanId,
    long startTime,
    short serviceType)
  {
    this();
    this.agentId = agentId;
    this.applicationName = applicationName;
    this.agentStartTime = agentStartTime;
    setAgentStartTimeIsSet(true);
    this.transactionId = org.apache.thrift.TBaseHelper.copyBinary(transactionId);
    this.spanId = spanId;
    setSpanIdIsSet(true);
    this.startTime = startTime;
    setStartTimeIsSet(true);
    this.serviceType = serviceType;
    setServiceTypeIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TSpan(TSpan other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetAgentId()) {
      this.agentId = other.agentId;
    }
    if (other.isSetApplicationName()) {
      this.applicationName = other.applicationName;
    }
    this.agentStartTime = other.agentStartTime;
    if (other.isSetTransactionId()) {
      this.transactionId = org.apache.thrift.TBaseHelper.copyBinary(other.transactionId);
    }
    this.spanId = other.spanId;
    this.parentSpanId = other.parentSpanId;
    this.startTime = other.startTime;
    this.elapsed = other.elapsed;
    if (other.isSetRpc()) {
      this.rpc = other.rpc;
    }
    this.serviceType = other.serviceType;
    if (other.isSetEndPoint()) {
      this.endPoint = other.endPoint;
    }
    if (other.isSetRemoteAddr()) {
      this.remoteAddr = other.remoteAddr;
    }
    if (other.isSetAnnotations()) {
      java.util.List<TAnnotation> __this__annotations = new java.util.ArrayList<TAnnotation>(other.annotations.size());
      for (TAnnotation other_element : other.annotations) {
        __this__annotations.add(new TAnnotation(other_element));
      }
      this.annotations = __this__annotations;
    }
    this.flag = other.flag;
    this.err = other.err;
    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;
    }
    if (other.isSetParentApplicationName()) {
      this.parentApplicationName = other.parentApplicationName;
    }
    this.parentApplicationType = other.parentApplicationType;
    if (other.isSetAcceptorHost()) {
      this.acceptorHost = other.acceptorHost;
    }
    this.apiId = other.apiId;
    if (other.isSetExceptionInfo()) {
      this.exceptionInfo = new TIntStringValue(other.exceptionInfo);
    }
    this.applicationServiceType = other.applicationServiceType;
    this.loggingTransactionInfo = other.loggingTransactionInfo;
    this.version = other.version;
  }

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

  @Override
  public void clear() {
    this.agentId = null;
    this.applicationName = null;
    setAgentStartTimeIsSet(false);
    this.agentStartTime = 0;
    this.transactionId = null;
    setSpanIdIsSet(false);
    this.spanId = 0;
    this.parentSpanId = -1L;

    setStartTimeIsSet(false);
    this.startTime = 0;
    this.elapsed = 0;

    this.rpc = null;
    setServiceTypeIsSet(false);
    this.serviceType = 0;
    this.endPoint = null;
    this.remoteAddr = null;
    this.annotations = null;
    this.flag = (short)0;

    setErrIsSet(false);
    this.err = 0;
    this.spanEventList = null;
    this.parentApplicationName = null;
    setParentApplicationTypeIsSet(false);
    this.parentApplicationType = 0;
    this.acceptorHost = null;
    setApiIdIsSet(false);
    this.apiId = 0;
    this.exceptionInfo = null;
    setApplicationServiceTypeIsSet(false);
    this.applicationServiceType = 0;
    setLoggingTransactionInfoIsSet(false);
    this.loggingTransactionInfo = 0;
    this.version = (byte)1;

  }

  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);
  }

  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 long getParentSpanId() {
    return this.parentSpanId;
  }

  public void setParentSpanId(long parentSpanId) {
    this.parentSpanId = parentSpanId;
    setParentSpanIdIsSet(true);
  }

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

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

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

  public long getStartTime() {
    return this.startTime;
  }

  public void setStartTime(long startTime) {
    this.startTime = startTime;
    setStartTimeIsSet(true);
  }

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

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

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

  public int getElapsed() {
    return this.elapsed;
  }

  public void setElapsed(int elapsed) {
    this.elapsed = elapsed;
    setElapsedIsSet(true);
  }

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

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

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

  public java.lang.String getRpc() {
    return this.rpc;
  }

  public void setRpc(java.lang.String rpc) {
    this.rpc = rpc;
  }

  public void unsetRpc() {
    this.rpc = null;
  }

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

  public void setRpcIsSet(boolean value) {
    if (!value) {
      this.rpc = null;
    }
  }

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

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

  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 */
  public boolean isSetServiceType() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __SERVICETYPE_ISSET_ID);
  }

  public void setServiceTypeIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __SERVICETYPE_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 java.lang.String getRemoteAddr() {
    return this.remoteAddr;
  }

  public void setRemoteAddr(java.lang.String remoteAddr) {
    this.remoteAddr = remoteAddr;
  }

  public void unsetRemoteAddr() {
    this.remoteAddr = null;
  }

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

  public void setRemoteAddrIsSet(boolean value) {
    if (!value) {
      this.remoteAddr = null;
    }
  }

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

  public java.util.Iterator<TAnnotation> getAnnotationsIterator() {
    return (this.annotations == null) ? null : this.annotations.iterator();
  }

  public void addToAnnotations(TAnnotation elem) {
    if (this.annotations == null) {
      this.annotations = new java.util.ArrayList<TAnnotation>();
    }
    this.annotations.add(elem);
  }

  public java.util.List<TAnnotation> getAnnotations() {
    return this.annotations;
  }

  public void setAnnotations(java.util.List<TAnnotation> annotations) {
    this.annotations = annotations;
  }

  public void unsetAnnotations() {
    this.annotations = null;
  }

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

  public void setAnnotationsIsSet(boolean value) {
    if (!value) {
      this.annotations = null;
    }
  }

  public short getFlag() {
    return this.flag;
  }

  public void setFlag(short flag) {
    this.flag = flag;
    setFlagIsSet(true);
  }

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

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

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

  public int getErr() {
    return this.err;
  }

  public void setErr(int err) {
    this.err = err;
    setErrIsSet(true);
  }

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

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

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

  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 java.lang.String getParentApplicationName() {
    return this.parentApplicationName;
  }

  public void setParentApplicationName(java.lang.String parentApplicationName) {
    this.parentApplicationName = parentApplicationName;
  }

  public void unsetParentApplicationName() {
    this.parentApplicationName = null;
  }

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

  public void setParentApplicationNameIsSet(boolean value) {
    if (!value) {
      this.parentApplicationName = null;
    }
  }

  public short getParentApplicationType() {
    return this.parentApplicationType;
  }

  public void setParentApplicationType(short parentApplicationType) {
    this.parentApplicationType = parentApplicationType;
    setParentApplicationTypeIsSet(true);
  }

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

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

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

  public java.lang.String getAcceptorHost() {
    return this.acceptorHost;
  }

  public void setAcceptorHost(java.lang.String acceptorHost) {
    this.acceptorHost = acceptorHost;
  }

  public void unsetAcceptorHost() {
    this.acceptorHost = null;
  }

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

  public void setAcceptorHostIsSet(boolean value) {
    if (!value) {
      this.acceptorHost = null;
    }
  }

  public int getApiId() {
    return this.apiId;
  }

  public void setApiId(int apiId) {
    this.apiId = apiId;
    setApiIdIsSet(true);
  }

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

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

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

  public TIntStringValue getExceptionInfo() {
    return this.exceptionInfo;
  }

  public void setExceptionInfo(TIntStringValue exceptionInfo) {
    this.exceptionInfo = exceptionInfo;
  }

  public void unsetExceptionInfo() {
    this.exceptionInfo = null;
  }

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

  public void setExceptionInfoIsSet(boolean value) {
    if (!value) {
      this.exceptionInfo = 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 byte getLoggingTransactionInfo() {
    return this.loggingTransactionInfo;
  }

  public void setLoggingTransactionInfo(byte loggingTransactionInfo) {
    this.loggingTransactionInfo = loggingTransactionInfo;
    setLoggingTransactionInfoIsSet(true);
  }

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

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

  public void setLoggingTransactionInfoIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LOGGINGTRANSACTIONINFO_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 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 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 PARENT_SPAN_ID:
      if (value == null) {
        unsetParentSpanId();
      } else {
        setParentSpanId((java.lang.Long)value);
      }
      break;

    case START_TIME:
      if (value == null) {
        unsetStartTime();
      } else {
        setStartTime((java.lang.Long)value);
      }
      break;

    case ELAPSED:
      if (value == null) {
        unsetElapsed();
      } else {
        setElapsed((java.lang.Integer)value);
      }
      break;

    case RPC:
      if (value == null) {
        unsetRpc();
      } else {
        setRpc((java.lang.String)value);
      }
      break;

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

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

    case REMOTE_ADDR:
      if (value == null) {
        unsetRemoteAddr();
      } else {
        setRemoteAddr((java.lang.String)value);
      }
      break;

    case ANNOTATIONS:
      if (value == null) {
        unsetAnnotations();
      } else {
        setAnnotations((java.util.List<TAnnotation>)value);
      }
      break;

    case FLAG:
      if (value == null) {
        unsetFlag();
      } else {
        setFlag((java.lang.Short)value);
      }
      break;

    case ERR:
      if (value == null) {
        unsetErr();
      } else {
        setErr((java.lang.Integer)value);
      }
      break;

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

    case PARENT_APPLICATION_NAME:
      if (value == null) {
        unsetParentApplicationName();
      } else {
        setParentApplicationName((java.lang.String)value);
      }
      break;

    case PARENT_APPLICATION_TYPE:
      if (value == null) {
        unsetParentApplicationType();
      } else {
        setParentApplicationType((java.lang.Short)value);
      }
      break;

    case ACCEPTOR_HOST:
      if (value == null) {
        unsetAcceptorHost();
      } else {
        setAcceptorHost((java.lang.String)value);
      }
      break;

    case API_ID:
      if (value == null) {
        unsetApiId();
      } else {
        setApiId((java.lang.Integer)value);
      }
      break;

    case EXCEPTION_INFO:
      if (value == null) {
        unsetExceptionInfo();
      } else {
        setExceptionInfo((TIntStringValue)value);
      }
      break;

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

    case LOGGING_TRANSACTION_INFO:
      if (value == null) {
        unsetLoggingTransactionInfo();
      } else {
        setLoggingTransactionInfo((java.lang.Byte)value);
      }
      break;

    case VERSION:
      if (value == null) {
        unsetVersion();
      } else {
        setVersion((java.lang.Byte)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 TRANSACTION_ID:
      return getTransactionId();

    case SPAN_ID:
      return getSpanId();

    case PARENT_SPAN_ID:
      return getParentSpanId();

    case START_TIME:
      return getStartTime();

    case ELAPSED:
      return getElapsed();

    case RPC:
      return getRpc();

    case SERVICE_TYPE:
      return getServiceType();

    case END_POINT:
      return getEndPoint();

    case REMOTE_ADDR:
      return getRemoteAddr();

    case ANNOTATIONS:
      return getAnnotations();

    case FLAG:
      return getFlag();

    case ERR:
      return getErr();

    case SPAN_EVENT_LIST:
      return getSpanEventList();

    case PARENT_APPLICATION_NAME:
      return getParentApplicationName();

    case PARENT_APPLICATION_TYPE:
      return getParentApplicationType();

    case ACCEPTOR_HOST:
      return getAcceptorHost();

    case API_ID:
      return getApiId();

    case EXCEPTION_INFO:
      return getExceptionInfo();

    case APPLICATION_SERVICE_TYPE:
      return getApplicationServiceType();

    case LOGGING_TRANSACTION_INFO:
      return getLoggingTransactionInfo();

    case VERSION:
      return getVersion();

    }
    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 TRANSACTION_ID:
      return isSetTransactionId();
    case SPAN_ID:
      return isSetSpanId();
    case PARENT_SPAN_ID:
      return isSetParentSpanId();
    case START_TIME:
      return isSetStartTime();
    case ELAPSED:
      return isSetElapsed();
    case RPC:
      return isSetRpc();
    case SERVICE_TYPE:
      return isSetServiceType();
    case END_POINT:
      return isSetEndPoint();
    case REMOTE_ADDR:
      return isSetRemoteAddr();
    case ANNOTATIONS:
      return isSetAnnotations();
    case FLAG:
      return isSetFlag();
    case ERR:
      return isSetErr();
    case SPAN_EVENT_LIST:
      return isSetSpanEventList();
    case PARENT_APPLICATION_NAME:
      return isSetParentApplicationName();
    case PARENT_APPLICATION_TYPE:
      return isSetParentApplicationType();
    case ACCEPTOR_HOST:
      return isSetAcceptorHost();
    case API_ID:
      return isSetApiId();
    case EXCEPTION_INFO:
      return isSetExceptionInfo();
    case APPLICATION_SERVICE_TYPE:
      return isSetApplicationServiceType();
    case LOGGING_TRANSACTION_INFO:
      return isSetLoggingTransactionInfo();
    case VERSION:
      return isSetVersion();
    }
    throw new java.lang.IllegalStateException();
  }

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

  public boolean equals(TSpan 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_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_parentSpanId = true && this.isSetParentSpanId();
    boolean that_present_parentSpanId = true && that.isSetParentSpanId();
    if (this_present_parentSpanId || that_present_parentSpanId) {
      if (!(this_present_parentSpanId && that_present_parentSpanId))
        return false;
      if (this.parentSpanId != that.parentSpanId)
        return false;
    }

    boolean this_present_startTime = true;
    boolean that_present_startTime = true;
    if (this_present_startTime || that_present_startTime) {
      if (!(this_present_startTime && that_present_startTime))
        return false;
      if (this.startTime != that.startTime)
        return false;
    }

    boolean this_present_elapsed = true && this.isSetElapsed();
    boolean that_present_elapsed = true && that.isSetElapsed();
    if (this_present_elapsed || that_present_elapsed) {
      if (!(this_present_elapsed && that_present_elapsed))
        return false;
      if (this.elapsed != that.elapsed)
        return false;
    }

    boolean this_present_rpc = true && this.isSetRpc();
    boolean that_present_rpc = true && that.isSetRpc();
    if (this_present_rpc || that_present_rpc) {
      if (!(this_present_rpc && that_present_rpc))
        return false;
      if (!this.rpc.equals(that.rpc))
        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_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_remoteAddr = true && this.isSetRemoteAddr();
    boolean that_present_remoteAddr = true && that.isSetRemoteAddr();
    if (this_present_remoteAddr || that_present_remoteAddr) {
      if (!(this_present_remoteAddr && that_present_remoteAddr))
        return false;
      if (!this.remoteAddr.equals(that.remoteAddr))
        return false;
    }

    boolean this_present_annotations = true && this.isSetAnnotations();
    boolean that_present_annotations = true && that.isSetAnnotations();
    if (this_present_annotations || that_present_annotations) {
      if (!(this_present_annotations && that_present_annotations))
        return false;
      if (!this.annotations.equals(that.annotations))
        return false;
    }

    boolean this_present_flag = true && this.isSetFlag();
    boolean that_present_flag = true && that.isSetFlag();
    if (this_present_flag || that_present_flag) {
      if (!(this_present_flag && that_present_flag))
        return false;
      if (this.flag != that.flag)
        return false;
    }

    boolean this_present_err = true && this.isSetErr();
    boolean that_present_err = true && that.isSetErr();
    if (this_present_err || that_present_err) {
      if (!(this_present_err && that_present_err))
        return false;
      if (this.err != that.err)
        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_parentApplicationName = true && this.isSetParentApplicationName();
    boolean that_present_parentApplicationName = true && that.isSetParentApplicationName();
    if (this_present_parentApplicationName || that_present_parentApplicationName) {
      if (!(this_present_parentApplicationName && that_present_parentApplicationName))
        return false;
      if (!this.parentApplicationName.equals(that.parentApplicationName))
        return false;
    }

    boolean this_present_parentApplicationType = true && this.isSetParentApplicationType();
    boolean that_present_parentApplicationType = true && that.isSetParentApplicationType();
    if (this_present_parentApplicationType || that_present_parentApplicationType) {
      if (!(this_present_parentApplicationType && that_present_parentApplicationType))
        return false;
      if (this.parentApplicationType != that.parentApplicationType)
        return false;
    }

    boolean this_present_acceptorHost = true && this.isSetAcceptorHost();
    boolean that_present_acceptorHost = true && that.isSetAcceptorHost();
    if (this_present_acceptorHost || that_present_acceptorHost) {
      if (!(this_present_acceptorHost && that_present_acceptorHost))
        return false;
      if (!this.acceptorHost.equals(that.acceptorHost))
        return false;
    }

    boolean this_present_apiId = true && this.isSetApiId();
    boolean that_present_apiId = true && that.isSetApiId();
    if (this_present_apiId || that_present_apiId) {
      if (!(this_present_apiId && that_present_apiId))
        return false;
      if (this.apiId != that.apiId)
        return false;
    }

    boolean this_present_exceptionInfo = true && this.isSetExceptionInfo();
    boolean that_present_exceptionInfo = true && that.isSetExceptionInfo();
    if (this_present_exceptionInfo || that_present_exceptionInfo) {
      if (!(this_present_exceptionInfo && that_present_exceptionInfo))
        return false;
      if (!this.exceptionInfo.equals(that.exceptionInfo))
        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_loggingTransactionInfo = true && this.isSetLoggingTransactionInfo();
    boolean that_present_loggingTransactionInfo = true && that.isSetLoggingTransactionInfo();
    if (this_present_loggingTransactionInfo || that_present_loggingTransactionInfo) {
      if (!(this_present_loggingTransactionInfo && that_present_loggingTransactionInfo))
        return false;
      if (this.loggingTransactionInfo != that.loggingTransactionInfo)
        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;
    }

    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 + ((isSetTransactionId()) ? 131071 : 524287);
    if (isSetTransactionId())
      hashCode = hashCode * 8191 + transactionId.hashCode();

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

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

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

    hashCode = hashCode * 8191 + ((isSetElapsed()) ? 131071 : 524287);
    if (isSetElapsed())
      hashCode = hashCode * 8191 + elapsed;

    hashCode = hashCode * 8191 + ((isSetRpc()) ? 131071 : 524287);
    if (isSetRpc())
      hashCode = hashCode * 8191 + rpc.hashCode();

    hashCode = hashCode * 8191 + serviceType;

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

    hashCode = hashCode * 8191 + ((isSetRemoteAddr()) ? 131071 : 524287);
    if (isSetRemoteAddr())
      hashCode = hashCode * 8191 + remoteAddr.hashCode();

    hashCode = hashCode * 8191 + ((isSetAnnotations()) ? 131071 : 524287);
    if (isSetAnnotations())
      hashCode = hashCode * 8191 + annotations.hashCode();

    hashCode = hashCode * 8191 + ((isSetFlag()) ? 131071 : 524287);
    if (isSetFlag())
      hashCode = hashCode * 8191 + flag;

    hashCode = hashCode * 8191 + ((isSetErr()) ? 131071 : 524287);
    if (isSetErr())
      hashCode = hashCode * 8191 + err;

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

    hashCode = hashCode * 8191 + ((isSetParentApplicationName()) ? 131071 : 524287);
    if (isSetParentApplicationName())
      hashCode = hashCode * 8191 + parentApplicationName.hashCode();

    hashCode = hashCode * 8191 + ((isSetParentApplicationType()) ? 131071 : 524287);
    if (isSetParentApplicationType())
      hashCode = hashCode * 8191 + parentApplicationType;

    hashCode = hashCode * 8191 + ((isSetAcceptorHost()) ? 131071 : 524287);
    if (isSetAcceptorHost())
      hashCode = hashCode * 8191 + acceptorHost.hashCode();

    hashCode = hashCode * 8191 + ((isSetApiId()) ? 131071 : 524287);
    if (isSetApiId())
      hashCode = hashCode * 8191 + apiId;

    hashCode = hashCode * 8191 + ((isSetExceptionInfo()) ? 131071 : 524287);
    if (isSetExceptionInfo())
      hashCode = hashCode * 8191 + exceptionInfo.hashCode();

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

    hashCode = hashCode * 8191 + ((isSetLoggingTransactionInfo()) ? 131071 : 524287);
    if (isSetLoggingTransactionInfo())
      hashCode = hashCode * 8191 + (int) (loggingTransactionInfo);

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

    return hashCode;
  }

  @Override
  public int compareTo(TSpan 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(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(isSetParentSpanId()).compareTo(other.isSetParentSpanId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetParentSpanId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parentSpanId, other.parentSpanId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetStartTime()).compareTo(other.isSetStartTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStartTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startTime, other.startTime);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetElapsed()).compareTo(other.isSetElapsed());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetElapsed()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.elapsed, other.elapsed);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetRpc()).compareTo(other.isSetRpc());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRpc()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.rpc, other.rpc);
      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(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(isSetRemoteAddr()).compareTo(other.isSetRemoteAddr());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRemoteAddr()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.remoteAddr, other.remoteAddr);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetAnnotations()).compareTo(other.isSetAnnotations());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAnnotations()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.annotations, other.annotations);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetFlag()).compareTo(other.isSetFlag());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetFlag()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.flag, other.flag);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetErr()).compareTo(other.isSetErr());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetErr()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.err, other.err);
      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(isSetParentApplicationName()).compareTo(other.isSetParentApplicationName());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetParentApplicationName()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parentApplicationName, other.parentApplicationName);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetParentApplicationType()).compareTo(other.isSetParentApplicationType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetParentApplicationType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.parentApplicationType, other.parentApplicationType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetAcceptorHost()).compareTo(other.isSetAcceptorHost());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAcceptorHost()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.acceptorHost, other.acceptorHost);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetApiId()).compareTo(other.isSetApiId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetApiId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.apiId, other.apiId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetExceptionInfo()).compareTo(other.isSetExceptionInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExceptionInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.exceptionInfo, other.exceptionInfo);
      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(isSetLoggingTransactionInfo()).compareTo(other.isSetLoggingTransactionInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLoggingTransactionInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.loggingTransactionInfo, other.loggingTransactionInfo);
      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;
      }
    }
    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("TSpan(");
    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("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 (isSetParentSpanId()) {
      if (!first) sb.append(", ");
      sb.append("parentSpanId:");
      sb.append(this.parentSpanId);
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("startTime:");
    sb.append(this.startTime);
    first = false;
    if (isSetElapsed()) {
      if (!first) sb.append(", ");
      sb.append("elapsed:");
      sb.append(this.elapsed);
      first = false;
    }
    if (isSetRpc()) {
      if (!first) sb.append(", ");
      sb.append("rpc:");
      if (this.rpc == null) {
        sb.append("null");
      } else {
        sb.append(this.rpc);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("serviceType:");
    sb.append(this.serviceType);
    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 (isSetRemoteAddr()) {
      if (!first) sb.append(", ");
      sb.append("remoteAddr:");
      if (this.remoteAddr == null) {
        sb.append("null");
      } else {
        sb.append(this.remoteAddr);
      }
      first = false;
    }
    if (isSetAnnotations()) {
      if (!first) sb.append(", ");
      sb.append("annotations:");
      if (this.annotations == null) {
        sb.append("null");
      } else {
        sb.append(this.annotations);
      }
      first = false;
    }
    if (isSetFlag()) {
      if (!first) sb.append(", ");
      sb.append("flag:");
      sb.append(this.flag);
      first = false;
    }
    if (isSetErr()) {
      if (!first) sb.append(", ");
      sb.append("err:");
      sb.append(this.err);
      first = false;
    }
    if (isSetSpanEventList()) {
      if (!first) sb.append(", ");
      sb.append("spanEventList:");
      if (this.spanEventList == null) {
        sb.append("null");
      } else {
        sb.append(this.spanEventList);
      }
      first = false;
    }
    if (isSetParentApplicationName()) {
      if (!first) sb.append(", ");
      sb.append("parentApplicationName:");
      if (this.parentApplicationName == null) {
        sb.append("null");
      } else {
        sb.append(this.parentApplicationName);
      }
      first = false;
    }
    if (isSetParentApplicationType()) {
      if (!first) sb.append(", ");
      sb.append("parentApplicationType:");
      sb.append(this.parentApplicationType);
      first = false;
    }
    if (isSetAcceptorHost()) {
      if (!first) sb.append(", ");
      sb.append("acceptorHost:");
      if (this.acceptorHost == null) {
        sb.append("null");
      } else {
        sb.append(this.acceptorHost);
      }
      first = false;
    }
    if (isSetApiId()) {
      if (!first) sb.append(", ");
      sb.append("apiId:");
      sb.append(this.apiId);
      first = false;
    }
    if (isSetExceptionInfo()) {
      if (!first) sb.append(", ");
      sb.append("exceptionInfo:");
      if (this.exceptionInfo == null) {
        sb.append("null");
      } else {
        sb.append(this.exceptionInfo);
      }
      first = false;
    }
    if (isSetApplicationServiceType()) {
      if (!first) sb.append(", ");
      sb.append("applicationServiceType:");
      sb.append(this.applicationServiceType);
      first = false;
    }
    if (isSetLoggingTransactionInfo()) {
      if (!first) sb.append(", ");
      sb.append("loggingTransactionInfo:");
      sb.append(this.loggingTransactionInfo);
      first = false;
    }
    if (isSetVersion()) {
      if (!first) sb.append(", ");
      sb.append("version:");
      sb.append(this.version);
      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 (exceptionInfo != null) {
      exceptionInfo.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 TSpanStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TSpanStandardScheme getScheme() {
      return new TSpanStandardScheme();
    }
  }

  private static class TSpanStandardScheme extends org.apache.thrift.scheme.StandardScheme<TSpan> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TSpan 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: // 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 7: // 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 8: // PARENT_SPAN_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.parentSpanId = iprot.readI64();
              struct.setParentSpanIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // START_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.startTime = iprot.readI64();
              struct.setStartTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // ELAPSED
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.elapsed = iprot.readI32();
              struct.setElapsedIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // RPC
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.rpc = iprot.readString();
              struct.setRpcIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // 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 13: // 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 14: // REMOTE_ADDR
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.remoteAddr = iprot.readString();
              struct.setRemoteAddrIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // ANNOTATIONS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
                struct.annotations = new java.util.ArrayList<TAnnotation>(_list8.size);
                TAnnotation _elem9;
                for (int _i10 = 0; _i10 < _list8.size; ++_i10)
                {
                  _elem9 = new TAnnotation();
                  _elem9.read(iprot);
                  struct.annotations.add(_elem9);
                }
                iprot.readListEnd();
              }
              struct.setAnnotationsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 16: // FLAG
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.flag = iprot.readI16();
              struct.setFlagIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 17: // ERR
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.err = iprot.readI32();
              struct.setErrIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 18: // SPAN_EVENT_LIST
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list11 = iprot.readListBegin();
                struct.spanEventList = new java.util.ArrayList<TSpanEvent>(_list11.size);
                TSpanEvent _elem12;
                for (int _i13 = 0; _i13 < _list11.size; ++_i13)
                {
                  _elem12 = new TSpanEvent();
                  _elem12.read(iprot);
                  struct.spanEventList.add(_elem12);
                }
                iprot.readListEnd();
              }
              struct.setSpanEventListIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 19: // PARENT_APPLICATION_NAME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.parentApplicationName = iprot.readString();
              struct.setParentApplicationNameIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // PARENT_APPLICATION_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.parentApplicationType = iprot.readI16();
              struct.setParentApplicationTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 21: // ACCEPTOR_HOST
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.acceptorHost = iprot.readString();
              struct.setAcceptorHostIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 25: // API_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.apiId = iprot.readI32();
              struct.setApiIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 26: // EXCEPTION_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.exceptionInfo = new TIntStringValue();
              struct.exceptionInfo.read(iprot);
              struct.setExceptionInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 30: // 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 31: // LOGGING_TRANSACTION_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.BYTE) {
              struct.loggingTransactionInfo = iprot.readByte();
              struct.setLoggingTransactionInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 32: // 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;
          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, TSpan 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();
      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.isSetParentSpanId()) {
        oprot.writeFieldBegin(PARENT_SPAN_ID_FIELD_DESC);
        oprot.writeI64(struct.parentSpanId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(START_TIME_FIELD_DESC);
      oprot.writeI64(struct.startTime);
      oprot.writeFieldEnd();
      if (struct.isSetElapsed()) {
        oprot.writeFieldBegin(ELAPSED_FIELD_DESC);
        oprot.writeI32(struct.elapsed);
        oprot.writeFieldEnd();
      }
      if (struct.rpc != null) {
        if (struct.isSetRpc()) {
          oprot.writeFieldBegin(RPC_FIELD_DESC);
          oprot.writeString(struct.rpc);
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldBegin(SERVICE_TYPE_FIELD_DESC);
      oprot.writeI16(struct.serviceType);
      oprot.writeFieldEnd();
      if (struct.endPoint != null) {
        if (struct.isSetEndPoint()) {
          oprot.writeFieldBegin(END_POINT_FIELD_DESC);
          oprot.writeString(struct.endPoint);
          oprot.writeFieldEnd();
        }
      }
      if (struct.remoteAddr != null) {
        if (struct.isSetRemoteAddr()) {
          oprot.writeFieldBegin(REMOTE_ADDR_FIELD_DESC);
          oprot.writeString(struct.remoteAddr);
          oprot.writeFieldEnd();
        }
      }
      if (struct.annotations != null) {
        if (struct.isSetAnnotations()) {
          oprot.writeFieldBegin(ANNOTATIONS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.annotations.size()));
            for (TAnnotation _iter14 : struct.annotations)
            {
              _iter14.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetFlag()) {
        oprot.writeFieldBegin(FLAG_FIELD_DESC);
        oprot.writeI16(struct.flag);
        oprot.writeFieldEnd();
      }
      if (struct.isSetErr()) {
        oprot.writeFieldBegin(ERR_FIELD_DESC);
        oprot.writeI32(struct.err);
        oprot.writeFieldEnd();
      }
      if (struct.spanEventList != null) {
        if (struct.isSetSpanEventList()) {
          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 _iter15 : struct.spanEventList)
            {
              _iter15.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.parentApplicationName != null) {
        if (struct.isSetParentApplicationName()) {
          oprot.writeFieldBegin(PARENT_APPLICATION_NAME_FIELD_DESC);
          oprot.writeString(struct.parentApplicationName);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetParentApplicationType()) {
        oprot.writeFieldBegin(PARENT_APPLICATION_TYPE_FIELD_DESC);
        oprot.writeI16(struct.parentApplicationType);
        oprot.writeFieldEnd();
      }
      if (struct.acceptorHost != null) {
        if (struct.isSetAcceptorHost()) {
          oprot.writeFieldBegin(ACCEPTOR_HOST_FIELD_DESC);
          oprot.writeString(struct.acceptorHost);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetApiId()) {
        oprot.writeFieldBegin(API_ID_FIELD_DESC);
        oprot.writeI32(struct.apiId);
        oprot.writeFieldEnd();
      }
      if (struct.exceptionInfo != null) {
        if (struct.isSetExceptionInfo()) {
          oprot.writeFieldBegin(EXCEPTION_INFO_FIELD_DESC);
          struct.exceptionInfo.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.isSetApplicationServiceType()) {
        oprot.writeFieldBegin(APPLICATION_SERVICE_TYPE_FIELD_DESC);
        oprot.writeI16(struct.applicationServiceType);
        oprot.writeFieldEnd();
      }
      if (struct.isSetLoggingTransactionInfo()) {
        oprot.writeFieldBegin(LOGGING_TRANSACTION_INFO_FIELD_DESC);
        oprot.writeByte(struct.loggingTransactionInfo);
        oprot.writeFieldEnd();
      }
      if (struct.isSetVersion()) {
        oprot.writeFieldBegin(VERSION_FIELD_DESC);
        oprot.writeByte(struct.version);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

  private static class TSpanTupleScheme extends org.apache.thrift.scheme.TupleScheme<TSpan> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TSpan 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.isSetTransactionId()) {
        optionals.set(3);
      }
      if (struct.isSetSpanId()) {
        optionals.set(4);
      }
      if (struct.isSetParentSpanId()) {
        optionals.set(5);
      }
      if (struct.isSetStartTime()) {
        optionals.set(6);
      }
      if (struct.isSetElapsed()) {
        optionals.set(7);
      }
      if (struct.isSetRpc()) {
        optionals.set(8);
      }
      if (struct.isSetServiceType()) {
        optionals.set(9);
      }
      if (struct.isSetEndPoint()) {
        optionals.set(10);
      }
      if (struct.isSetRemoteAddr()) {
        optionals.set(11);
      }
      if (struct.isSetAnnotations()) {
        optionals.set(12);
      }
      if (struct.isSetFlag()) {
        optionals.set(13);
      }
      if (struct.isSetErr()) {
        optionals.set(14);
      }
      if (struct.isSetSpanEventList()) {
        optionals.set(15);
      }
      if (struct.isSetParentApplicationName()) {
        optionals.set(16);
      }
      if (struct.isSetParentApplicationType()) {
        optionals.set(17);
      }
      if (struct.isSetAcceptorHost()) {
        optionals.set(18);
      }
      if (struct.isSetApiId()) {
        optionals.set(19);
      }
      if (struct.isSetExceptionInfo()) {
        optionals.set(20);
      }
      if (struct.isSetApplicationServiceType()) {
        optionals.set(21);
      }
      if (struct.isSetLoggingTransactionInfo()) {
        optionals.set(22);
      }
      if (struct.isSetVersion()) {
        optionals.set(23);
      }
      oprot.writeBitSet(optionals, 24);
      if (struct.isSetAgentId()) {
        oprot.writeString(struct.agentId);
      }
      if (struct.isSetApplicationName()) {
        oprot.writeString(struct.applicationName);
      }
      if (struct.isSetAgentStartTime()) {
        oprot.writeI64(struct.agentStartTime);
      }
      if (struct.isSetTransactionId()) {
        oprot.writeBinary(struct.transactionId);
      }
      if (struct.isSetSpanId()) {
        oprot.writeI64(struct.spanId);
      }
      if (struct.isSetParentSpanId()) {
        oprot.writeI64(struct.parentSpanId);
      }
      if (struct.isSetStartTime()) {
        oprot.writeI64(struct.startTime);
      }
      if (struct.isSetElapsed()) {
        oprot.writeI32(struct.elapsed);
      }
      if (struct.isSetRpc()) {
        oprot.writeString(struct.rpc);
      }
      if (struct.isSetServiceType()) {
        oprot.writeI16(struct.serviceType);
      }
      if (struct.isSetEndPoint()) {
        oprot.writeString(struct.endPoint);
      }
      if (struct.isSetRemoteAddr()) {
        oprot.writeString(struct.remoteAddr);
      }
      if (struct.isSetAnnotations()) {
        {
          oprot.writeI32(struct.annotations.size());
          for (TAnnotation _iter16 : struct.annotations)
          {
            _iter16.write(oprot);
          }
        }
      }
      if (struct.isSetFlag()) {
        oprot.writeI16(struct.flag);
      }
      if (struct.isSetErr()) {
        oprot.writeI32(struct.err);
      }
      if (struct.isSetSpanEventList()) {
        {
          oprot.writeI32(struct.spanEventList.size());
          for (TSpanEvent _iter17 : struct.spanEventList)
          {
            _iter17.write(oprot);
          }
        }
      }
      if (struct.isSetParentApplicationName()) {
        oprot.writeString(struct.parentApplicationName);
      }
      if (struct.isSetParentApplicationType()) {
        oprot.writeI16(struct.parentApplicationType);
      }
      if (struct.isSetAcceptorHost()) {
        oprot.writeString(struct.acceptorHost);
      }
      if (struct.isSetApiId()) {
        oprot.writeI32(struct.apiId);
      }
      if (struct.isSetExceptionInfo()) {
        struct.exceptionInfo.write(oprot);
      }
      if (struct.isSetApplicationServiceType()) {
        oprot.writeI16(struct.applicationServiceType);
      }
      if (struct.isSetLoggingTransactionInfo()) {
        oprot.writeByte(struct.loggingTransactionInfo);
      }
      if (struct.isSetVersion()) {
        oprot.writeByte(struct.version);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TSpan struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(24);
      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.transactionId = iprot.readBinary();
        struct.setTransactionIdIsSet(true);
      }
      if (incoming.get(4)) {
        struct.spanId = iprot.readI64();
        struct.setSpanIdIsSet(true);
      }
      if (incoming.get(5)) {
        struct.parentSpanId = iprot.readI64();
        struct.setParentSpanIdIsSet(true);
      }
      if (incoming.get(6)) {
        struct.startTime = iprot.readI64();
        struct.setStartTimeIsSet(true);
      }
      if (incoming.get(7)) {
        struct.elapsed = iprot.readI32();
        struct.setElapsedIsSet(true);
      }
      if (incoming.get(8)) {
        struct.rpc = iprot.readString();
        struct.setRpcIsSet(true);
      }
      if (incoming.get(9)) {
        struct.serviceType = iprot.readI16();
        struct.setServiceTypeIsSet(true);
      }
      if (incoming.get(10)) {
        struct.endPoint = iprot.readString();
        struct.setEndPointIsSet(true);
      }
      if (incoming.get(11)) {
        struct.remoteAddr = iprot.readString();
        struct.setRemoteAddrIsSet(true);
      }
      if (incoming.get(12)) {
        {
          org.apache.thrift.protocol.TList _list18 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.annotations = new java.util.ArrayList<TAnnotation>(_list18.size);
          TAnnotation _elem19;
          for (int _i20 = 0; _i20 < _list18.size; ++_i20)
          {
            _elem19 = new TAnnotation();
            _elem19.read(iprot);
            struct.annotations.add(_elem19);
          }
        }
        struct.setAnnotationsIsSet(true);
      }
      if (incoming.get(13)) {
        struct.flag = iprot.readI16();
        struct.setFlagIsSet(true);
      }
      if (incoming.get(14)) {
        struct.err = iprot.readI32();
        struct.setErrIsSet(true);
      }
      if (incoming.get(15)) {
        {
          org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.spanEventList = new java.util.ArrayList<TSpanEvent>(_list21.size);
          TSpanEvent _elem22;
          for (int _i23 = 0; _i23 < _list21.size; ++_i23)
          {
            _elem22 = new TSpanEvent();
            _elem22.read(iprot);
            struct.spanEventList.add(_elem22);
          }
        }
        struct.setSpanEventListIsSet(true);
      }
      if (incoming.get(16)) {
        struct.parentApplicationName = iprot.readString();
        struct.setParentApplicationNameIsSet(true);
      }
      if (incoming.get(17)) {
        struct.parentApplicationType = iprot.readI16();
        struct.setParentApplicationTypeIsSet(true);
      }
      if (incoming.get(18)) {
        struct.acceptorHost = iprot.readString();
        struct.setAcceptorHostIsSet(true);
      }
      if (incoming.get(19)) {
        struct.apiId = iprot.readI32();
        struct.setApiIdIsSet(true);
      }
      if (incoming.get(20)) {
        struct.exceptionInfo = new TIntStringValue();
        struct.exceptionInfo.read(iprot);
        struct.setExceptionInfoIsSet(true);
      }
      if (incoming.get(21)) {
        struct.applicationServiceType = iprot.readI16();
        struct.setApplicationServiceTypeIsSet(true);
      }
      if (incoming.get(22)) {
        struct.loggingTransactionInfo = iprot.readByte();
        struct.setLoggingTransactionInfoIsSet(true);
      }
      if (incoming.get(23)) {
        struct.version = iprot.readByte();
        struct.setVersionIsSet(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();
  }
}

