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

io.jaegertracing.crossdock.thrift.ObservedSpan 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.crossdock.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)", date = "2022-07-01")
public class ObservedSpan 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("ObservedSpan");

  private static final org.apache.thrift.protocol.TField TRACE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("traceId", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField SAMPLED_FIELD_DESC = new org.apache.thrift.protocol.TField("sampled", org.apache.thrift.protocol.TType.BOOL, (short)2);
  private static final org.apache.thrift.protocol.TField BAGGAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("baggage", org.apache.thrift.protocol.TType.STRING, (short)3);

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

  public @org.apache.thrift.annotation.Nullable java.lang.String traceId; // required
  public boolean sampled; // required
  public @org.apache.thrift.annotation.Nullable java.lang.String baggage; // 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 {
    TRACE_ID((short)1, "traceId"),
    SAMPLED((short)2, "sampled"),
    BAGGAGE((short)3, "baggage");

    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: // TRACE_ID
          return TRACE_ID;
        case 2: // SAMPLED
          return SAMPLED;
        case 3: // BAGGAGE
          return BAGGAGE;
        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
  private static final int __SAMPLED_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  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.TRACE_ID, new org.apache.thrift.meta_data.FieldMetaData("traceId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.SAMPLED, new org.apache.thrift.meta_data.FieldMetaData("sampled", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.BAGGAGE, new org.apache.thrift.meta_data.FieldMetaData("baggage", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ObservedSpan.class, metaDataMap);
  }

  public ObservedSpan() {
  }

  public ObservedSpan(
    java.lang.String traceId,
    boolean sampled,
    java.lang.String baggage)
  {
    this();
    this.traceId = traceId;
    this.sampled = sampled;
    setSampledIsSet(true);
    this.baggage = baggage;
  }

  /**
   * Performs a deep copy on other.
   */
  public ObservedSpan(ObservedSpan other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetTraceId()) {
      this.traceId = other.traceId;
    }
    this.sampled = other.sampled;
    if (other.isSetBaggage()) {
      this.baggage = other.baggage;
    }
  }

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

  @Override
  public void clear() {
    this.traceId = null;
    setSampledIsSet(false);
    this.sampled = false;
    this.baggage = null;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getTraceId() {
    return this.traceId;
  }

  public ObservedSpan setTraceId(@org.apache.thrift.annotation.Nullable java.lang.String traceId) {
    this.traceId = traceId;
    return this;
  }

  public void unsetTraceId() {
    this.traceId = null;
  }

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

  public void setTraceIdIsSet(boolean value) {
    if (!value) {
      this.traceId = null;
    }
  }

  public boolean isSampled() {
    return this.sampled;
  }

  public ObservedSpan setSampled(boolean sampled) {
    this.sampled = sampled;
    setSampledIsSet(true);
    return this;
  }

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

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

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

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getBaggage() {
    return this.baggage;
  }

  public ObservedSpan setBaggage(@org.apache.thrift.annotation.Nullable java.lang.String baggage) {
    this.baggage = baggage;
    return this;
  }

  public void unsetBaggage() {
    this.baggage = null;
  }

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

  public void setBaggageIsSet(boolean value) {
    if (!value) {
      this.baggage = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case TRACE_ID:
      if (value == null) {
        unsetTraceId();
      } else {
        setTraceId((java.lang.String)value);
      }
      break;

    case SAMPLED:
      if (value == null) {
        unsetSampled();
      } else {
        setSampled((java.lang.Boolean)value);
      }
      break;

    case BAGGAGE:
      if (value == null) {
        unsetBaggage();
      } else {
        setBaggage((java.lang.String)value);
      }
      break;

    }
  }

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

    case SAMPLED:
      return isSampled();

    case BAGGAGE:
      return getBaggage();

    }
    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 TRACE_ID:
      return isSetTraceId();
    case SAMPLED:
      return isSetSampled();
    case BAGGAGE:
      return isSetBaggage();
    }
    throw new java.lang.IllegalStateException();
  }

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

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

    boolean this_present_traceId = true && this.isSetTraceId();
    boolean that_present_traceId = true && that.isSetTraceId();
    if (this_present_traceId || that_present_traceId) {
      if (!(this_present_traceId && that_present_traceId))
        return false;
      if (!this.traceId.equals(that.traceId))
        return false;
    }

    boolean this_present_sampled = true;
    boolean that_present_sampled = true;
    if (this_present_sampled || that_present_sampled) {
      if (!(this_present_sampled && that_present_sampled))
        return false;
      if (this.sampled != that.sampled)
        return false;
    }

    boolean this_present_baggage = true && this.isSetBaggage();
    boolean that_present_baggage = true && that.isSetBaggage();
    if (this_present_baggage || that_present_baggage) {
      if (!(this_present_baggage && that_present_baggage))
        return false;
      if (!this.baggage.equals(that.baggage))
        return false;
    }

    return true;
  }

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

    hashCode = hashCode * 8191 + ((isSetTraceId()) ? 131071 : 524287);
    if (isSetTraceId())
      hashCode = hashCode * 8191 + traceId.hashCode();

    hashCode = hashCode * 8191 + ((sampled) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetBaggage()) ? 131071 : 524287);
    if (isSetBaggage())
      hashCode = hashCode * 8191 + baggage.hashCode();

    return hashCode;
  }

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

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetTraceId()).compareTo(other.isSetTraceId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetTraceId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.traceId, other.traceId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetSampled()).compareTo(other.isSetSampled());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSampled()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sampled, other.sampled);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetBaggage()).compareTo(other.isSetBaggage());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBaggage()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.baggage, other.baggage);
      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("ObservedSpan(");
    boolean first = true;

    sb.append("traceId:");
    if (this.traceId == null) {
      sb.append("null");
    } else {
      sb.append(this.traceId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("sampled:");
    sb.append(this.sampled);
    first = false;
    if (!first) sb.append(", ");
    sb.append("baggage:");
    if (this.baggage == null) {
      sb.append("null");
    } else {
      sb.append(this.baggage);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (traceId == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'traceId' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'sampled' because it's a primitive and you chose the non-beans generator.
    if (baggage == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'baggage' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

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

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

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

    public void read(org.apache.thrift.protocol.TProtocol iprot, ObservedSpan 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: // TRACE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.traceId = iprot.readString();
              struct.setTraceIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SAMPLED
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.sampled = iprot.readBool();
              struct.setSampledIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BAGGAGE
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.baggage = iprot.readString();
              struct.setBaggageIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetSampled()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'sampled' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.traceId != null) {
        oprot.writeFieldBegin(TRACE_ID_FIELD_DESC);
        oprot.writeString(struct.traceId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(SAMPLED_FIELD_DESC);
      oprot.writeBool(struct.sampled);
      oprot.writeFieldEnd();
      if (struct.baggage != null) {
        oprot.writeFieldBegin(BAGGAGE_FIELD_DESC);
        oprot.writeString(struct.baggage);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

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

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

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, ObservedSpan struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.traceId);
      oprot.writeBool(struct.sampled);
      oprot.writeString(struct.baggage);
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, ObservedSpan struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.traceId = iprot.readString();
      struct.setTraceIdIsSet(true);
      struct.sampled = iprot.readBool();
      struct.setSampledIsSet(true);
      struct.baggage = iprot.readString();
      struct.setBaggageIsSet(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();
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy