All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.jaegertracing.agent.thrift.Agent Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Thrift Compiler (0.12.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package io.jaegertracing.agent.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2022-07-01")
public class Agent {

  public interface Iface {

    public void emitZipkinBatch(java.util.List spans) throws org.apache.thrift.TException;

    public void emitBatch(io.jaegertracing.thriftjava.Batch batch) throws org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void emitZipkinBatch(java.util.List spans, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

    public void emitBatch(io.jaegertracing.thriftjava.Batch batch, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory {
      public Factory() {}
      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }
      public Client getClient(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot)
    {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public void emitZipkinBatch(java.util.List spans) throws org.apache.thrift.TException
    {
      send_emitZipkinBatch(spans);
    }

    public void send_emitZipkinBatch(java.util.List spans) throws org.apache.thrift.TException
    {
      emitZipkinBatch_args args = new emitZipkinBatch_args();
      args.setSpans(spans);
      sendBaseOneway("emitZipkinBatch", args);
    }

    public void emitBatch(io.jaegertracing.thriftjava.Batch batch) throws org.apache.thrift.TException
    {
      send_emitBatch(batch);
    }

    public void send_emitBatch(io.jaegertracing.thriftjava.Batch batch) throws org.apache.thrift.TException
    {
      emitBatch_args args = new emitBatch_args();
      args.setBatch(batch);
      sendBaseOneway("emitBatch", args);
    }

  }
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
    public static class Factory implements org.apache.thrift.async.TAsyncClientFactory {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;
      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }
      public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.async.TAsyncClientManager clientManager, org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    public void emitZipkinBatch(java.util.List spans, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      emitZipkinBatch_call method_call = new emitZipkinBatch_call(spans, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class emitZipkinBatch_call extends org.apache.thrift.async.TAsyncMethodCall {
      private java.util.List spans;
      public emitZipkinBatch_call(java.util.List spans, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, true);
        this.spans = spans;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("emitZipkinBatch", org.apache.thrift.protocol.TMessageType.ONEWAY, 0));
        emitZipkinBatch_args args = new emitZipkinBatch_args();
        args.setSpans(spans);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Void getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new java.lang.IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return null;
      }
    }

    public void emitBatch(io.jaegertracing.thriftjava.Batch batch, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
      checkReady();
      emitBatch_call method_call = new emitBatch_call(batch, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = method_call;
      ___manager.call(method_call);
    }

    public static class emitBatch_call extends org.apache.thrift.async.TAsyncMethodCall {
      private io.jaegertracing.thriftjava.Batch batch;
      public emitBatch_call(io.jaegertracing.thriftjava.Batch batch, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, true);
        this.batch = batch;
      }

      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("emitBatch", org.apache.thrift.protocol.TMessageType.ONEWAY, 0));
        emitBatch_args args = new emitBatch_args();
        args.setBatch(batch);
        args.write(prot);
        prot.writeMessageEnd();
      }

      public Void getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new java.lang.IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
        return null;
      }
    }

  }

  public static class Processor extends org.apache.thrift.TBaseProcessor implements org.apache.thrift.TProcessor {
    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());
    public Processor(I iface) {
      super(iface, getProcessMap(new java.util.HashMap>()));
    }

    protected Processor(I iface, java.util.Map> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static  java.util.Map> getProcessMap(java.util.Map> processMap) {
      processMap.put("emitZipkinBatch", new emitZipkinBatch());
      processMap.put("emitBatch", new emitBatch());
      return processMap;
    }

    public static class emitZipkinBatch extends org.apache.thrift.ProcessFunction {
      public emitZipkinBatch() {
        super("emitZipkinBatch");
      }

      public emitZipkinBatch_args getEmptyArgsInstance() {
        return new emitZipkinBatch_args();
      }

      protected boolean isOneway() {
        return true;
      }

      @Override
      protected boolean rethrowUnhandledExceptions() {
        return false;
      }

      public org.apache.thrift.TBase getResult(I iface, emitZipkinBatch_args args) throws org.apache.thrift.TException {
        iface.emitZipkinBatch(args.spans);
        return null;
      }
    }

    public static class emitBatch extends org.apache.thrift.ProcessFunction {
      public emitBatch() {
        super("emitBatch");
      }

      public emitBatch_args getEmptyArgsInstance() {
        return new emitBatch_args();
      }

      protected boolean isOneway() {
        return true;
      }

      @Override
      protected boolean rethrowUnhandledExceptions() {
        return false;
      }

      public org.apache.thrift.TBase getResult(I iface, emitBatch_args args) throws org.apache.thrift.TException {
        iface.emitBatch(args.batch);
        return null;
      }
    }

  }

  public static class AsyncProcessor extends org.apache.thrift.TBaseAsyncProcessor {
    private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(AsyncProcessor.class.getName());
    public AsyncProcessor(I iface) {
      super(iface, getProcessMap(new java.util.HashMap>()));
    }

    protected AsyncProcessor(I iface, java.util.Map> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static  java.util.Map> getProcessMap(java.util.Map> processMap) {
      processMap.put("emitZipkinBatch", new emitZipkinBatch());
      processMap.put("emitBatch", new emitBatch());
      return processMap;
    }

    public static class emitZipkinBatch extends org.apache.thrift.AsyncProcessFunction {
      public emitZipkinBatch() {
        super("emitZipkinBatch");
      }

      public emitZipkinBatch_args getEmptyArgsInstance() {
        return new emitZipkinBatch_args();
      }

      public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new org.apache.thrift.async.AsyncMethodCallback() { 
          public void onComplete(Void o) {
          }
          public void onError(java.lang.Exception e) {
            if (e instanceof org.apache.thrift.transport.TTransportException) {
              _LOGGER.error("TTransportException inside handler", e);
              fb.close();
            } else {
              _LOGGER.error("Exception inside oneway handler", e);
            }
          }
        };
      }

      protected boolean isOneway() {
        return true;
      }

      public void start(I iface, emitZipkinBatch_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
        iface.emitZipkinBatch(args.spans,resultHandler);
      }
    }

    public static class emitBatch extends org.apache.thrift.AsyncProcessFunction {
      public emitBatch() {
        super("emitBatch");
      }

      public emitBatch_args getEmptyArgsInstance() {
        return new emitBatch_args();
      }

      public org.apache.thrift.async.AsyncMethodCallback getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new org.apache.thrift.async.AsyncMethodCallback() { 
          public void onComplete(Void o) {
          }
          public void onError(java.lang.Exception e) {
            if (e instanceof org.apache.thrift.transport.TTransportException) {
              _LOGGER.error("TTransportException inside handler", e);
              fb.close();
            } else {
              _LOGGER.error("Exception inside oneway handler", e);
            }
          }
        };
      }

      protected boolean isOneway() {
        return true;
      }

      public void start(I iface, emitBatch_args args, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
        iface.emitBatch(args.batch,resultHandler);
      }
    }

  }

  public static class emitZipkinBatch_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("emitZipkinBatch_args");

    private static final org.apache.thrift.protocol.TField SPANS_FIELD_DESC = new org.apache.thrift.protocol.TField("spans", org.apache.thrift.protocol.TType.LIST, (short)1);

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

    public @org.apache.thrift.annotation.Nullable java.util.List spans; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      SPANS((short)1, "spans");

      private static final java.util.Map byName = new java.util.HashMap();

      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.
       */
      @org.apache.thrift.annotation.Nullable
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // SPANS
            return SPANS;
          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.
       */
      @org.apache.thrift.annotation.Nullable
      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
    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.SPANS, new org.apache.thrift.meta_data.FieldMetaData("spans", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.twitter.zipkin.thriftjava.Span.class))));
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(emitZipkinBatch_args.class, metaDataMap);
    }

    public emitZipkinBatch_args() {
    }

    public emitZipkinBatch_args(
      java.util.List spans)
    {
      this();
      this.spans = spans;
    }

    /**
     * Performs a deep copy on other.
     */
    public emitZipkinBatch_args(emitZipkinBatch_args other) {
      if (other.isSetSpans()) {
        java.util.List __this__spans = new java.util.ArrayList(other.spans.size());
        for (com.twitter.zipkin.thriftjava.Span other_element : other.spans) {
          __this__spans.add(new com.twitter.zipkin.thriftjava.Span(other_element));
        }
        this.spans = __this__spans;
      }
    }

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

    @Override
    public void clear() {
      this.spans = null;
    }

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

    @org.apache.thrift.annotation.Nullable
    public java.util.Iterator getSpansIterator() {
      return (this.spans == null) ? null : this.spans.iterator();
    }

    public void addToSpans(com.twitter.zipkin.thriftjava.Span elem) {
      if (this.spans == null) {
        this.spans = new java.util.ArrayList();
      }
      this.spans.add(elem);
    }

    @org.apache.thrift.annotation.Nullable
    public java.util.List getSpans() {
      return this.spans;
    }

    public emitZipkinBatch_args setSpans(@org.apache.thrift.annotation.Nullable java.util.List spans) {
      this.spans = spans;
      return this;
    }

    public void unsetSpans() {
      this.spans = null;
    }

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

    public void setSpansIsSet(boolean value) {
      if (!value) {
        this.spans = null;
      }
    }

    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
      switch (field) {
      case SPANS:
        if (value == null) {
          unsetSpans();
        } else {
          setSpans((java.util.List)value);
        }
        break;

      }
    }

    @org.apache.thrift.annotation.Nullable
    public java.lang.Object getFieldValue(_Fields field) {
      switch (field) {
      case SPANS:
        return getSpans();

      }
      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 SPANS:
        return isSetSpans();
      }
      throw new java.lang.IllegalStateException();
    }

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

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

      boolean this_present_spans = true && this.isSetSpans();
      boolean that_present_spans = true && that.isSetSpans();
      if (this_present_spans || that_present_spans) {
        if (!(this_present_spans && that_present_spans))
          return false;
        if (!this.spans.equals(that.spans))
          return false;
      }

      return true;
    }

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

      hashCode = hashCode * 8191 + ((isSetSpans()) ? 131071 : 524287);
      if (isSetSpans())
        hashCode = hashCode * 8191 + spans.hashCode();

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = java.lang.Boolean.valueOf(isSetSpans()).compareTo(other.isSetSpans());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSpans()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.spans, other.spans);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    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("emitZipkinBatch_args(");
      boolean first = true;

      sb.append("spans:");
      if (this.spans == null) {
        sb.append("null");
      } else {
        sb.append(this.spans);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
      try {
        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 emitZipkinBatch_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
      public emitZipkinBatch_argsStandardScheme getScheme() {
        return new emitZipkinBatch_argsStandardScheme();
      }
    }

    private static class emitZipkinBatch_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, emitZipkinBatch_args 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: // SPANS
              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
                {
                  org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
                  struct.spans = new java.util.ArrayList(_list0.size);
                  @org.apache.thrift.annotation.Nullable com.twitter.zipkin.thriftjava.Span _elem1;
                  for (int _i2 = 0; _i2 < _list0.size; ++_i2)
                  {
                    _elem1 = new com.twitter.zipkin.thriftjava.Span();
                    _elem1.read(iprot);
                    struct.spans.add(_elem1);
                  }
                  iprot.readListEnd();
                }
                struct.setSpansIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.spans != null) {
          oprot.writeFieldBegin(SPANS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.spans.size()));
            for (com.twitter.zipkin.thriftjava.Span _iter3 : struct.spans)
            {
              _iter3.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

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

    private static class emitZipkinBatch_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, emitZipkinBatch_args 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.isSetSpans()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSpans()) {
          {
            oprot.writeI32(struct.spans.size());
            for (com.twitter.zipkin.thriftjava.Span _iter4 : struct.spans)
            {
              _iter4.write(oprot);
            }
          }
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, emitZipkinBatch_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          {
            org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
            struct.spans = new java.util.ArrayList(_list5.size);
            @org.apache.thrift.annotation.Nullable com.twitter.zipkin.thriftjava.Span _elem6;
            for (int _i7 = 0; _i7 < _list5.size; ++_i7)
            {
              _elem6 = new com.twitter.zipkin.thriftjava.Span();
              _elem6.read(iprot);
              struct.spans.add(_elem6);
            }
          }
          struct.setSpansIsSet(true);
        }
      }
    }

    private static  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();
    }
  }

  public static class emitBatch_args implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable   {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("emitBatch_args");

    private static final org.apache.thrift.protocol.TField BATCH_FIELD_DESC = new org.apache.thrift.protocol.TField("batch", org.apache.thrift.protocol.TType.STRUCT, (short)1);

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

    public @org.apache.thrift.annotation.Nullable io.jaegertracing.thriftjava.Batch batch; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
      BATCH((short)1, "batch");

      private static final java.util.Map byName = new java.util.HashMap();

      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.
       */
      @org.apache.thrift.annotation.Nullable
      public static _Fields findByThriftId(int fieldId) {
        switch(fieldId) {
          case 1: // BATCH
            return BATCH;
          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.
       */
      @org.apache.thrift.annotation.Nullable
      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
    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.BATCH, new org.apache.thrift.meta_data.FieldMetaData("batch", org.apache.thrift.TFieldRequirementType.DEFAULT, 
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, io.jaegertracing.thriftjava.Batch.class)));
      metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(emitBatch_args.class, metaDataMap);
    }

    public emitBatch_args() {
    }

    public emitBatch_args(
      io.jaegertracing.thriftjava.Batch batch)
    {
      this();
      this.batch = batch;
    }

    /**
     * Performs a deep copy on other.
     */
    public emitBatch_args(emitBatch_args other) {
      if (other.isSetBatch()) {
        this.batch = new io.jaegertracing.thriftjava.Batch(other.batch);
      }
    }

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

    @Override
    public void clear() {
      this.batch = null;
    }

    @org.apache.thrift.annotation.Nullable
    public io.jaegertracing.thriftjava.Batch getBatch() {
      return this.batch;
    }

    public emitBatch_args setBatch(@org.apache.thrift.annotation.Nullable io.jaegertracing.thriftjava.Batch batch) {
      this.batch = batch;
      return this;
    }

    public void unsetBatch() {
      this.batch = null;
    }

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

    public void setBatchIsSet(boolean value) {
      if (!value) {
        this.batch = null;
      }
    }

    public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
      switch (field) {
      case BATCH:
        if (value == null) {
          unsetBatch();
        } else {
          setBatch((io.jaegertracing.thriftjava.Batch)value);
        }
        break;

      }
    }

    @org.apache.thrift.annotation.Nullable
    public java.lang.Object getFieldValue(_Fields field) {
      switch (field) {
      case BATCH:
        return getBatch();

      }
      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 BATCH:
        return isSetBatch();
      }
      throw new java.lang.IllegalStateException();
    }

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

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

      boolean this_present_batch = true && this.isSetBatch();
      boolean that_present_batch = true && that.isSetBatch();
      if (this_present_batch || that_present_batch) {
        if (!(this_present_batch && that_present_batch))
          return false;
        if (!this.batch.equals(that.batch))
          return false;
      }

      return true;
    }

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

      hashCode = hashCode * 8191 + ((isSetBatch()) ? 131071 : 524287);
      if (isSetBatch())
        hashCode = hashCode * 8191 + batch.hashCode();

      return hashCode;
    }

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

      int lastComparison = 0;

      lastComparison = java.lang.Boolean.valueOf(isSetBatch()).compareTo(other.isSetBatch());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetBatch()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.batch, other.batch);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    @org.apache.thrift.annotation.Nullable
    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("emitBatch_args(");
      boolean first = true;

      sb.append("batch:");
      if (this.batch == null) {
        sb.append("null");
      } else {
        sb.append(this.batch);
      }
      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 (batch != null) {
        batch.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 {
        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 emitBatch_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
      public emitBatch_argsStandardScheme getScheme() {
        return new emitBatch_argsStandardScheme();
      }
    }

    private static class emitBatch_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme {

      public void read(org.apache.thrift.protocol.TProtocol iprot, emitBatch_args 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: // BATCH
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.batch = new io.jaegertracing.thriftjava.Batch();
                struct.batch.read(iprot);
                struct.setBatchIsSet(true);
              } else { 
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate method
        struct.validate();
      }

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

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.batch != null) {
          oprot.writeFieldBegin(BATCH_FIELD_DESC);
          struct.batch.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

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

    private static class emitBatch_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, emitBatch_args 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.isSetBatch()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetBatch()) {
          struct.batch.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, emitBatch_args struct) throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
        java.util.BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.batch = new io.jaegertracing.thriftjava.Batch();
          struct.batch.read(iprot);
          struct.setBatchIsSet(true);
        }
      }
    }

    private static  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();
    }
  }

}