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

open_rtb.DataAvro Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package open_rtb;

/** 3.3.13 Data Object
The data and segment objects together allow data about the user to be passed to bidders in the bid request. This data may be from multiple sources (e.g., the exchange itself, third party providers) as specified by the data object ID field. A bid request can mix data objects from multiple providers.
The data object itself and all of its parameters are optional, so default values are not provided. If an optional parameter is not specified, it should be considered unknown. */
@org.apache.avro.specific.AvroGenerated
final public class DataAvro extends org.apache.avro.specific.SpecificRecordBase {

  /** Exchange specific ID for the data provider. */
  org.apache.avro.util.Utf8 id;
  /** Data provider name. */
  org.apache.avro.util.Utf8 name;
  /** Array of segment objects. */
  org.apache.avro.generic.GenericData.Array segment;

  private boolean _frozen = false;

  /** Default constructor, does not initialize fields to their default values from the schema. Only use this if you know what you are doing. */
  public DataAvro() {}

  public DataAvro freeze() {
    _frozen = true;
    segment.forEach(e -> e.freeze());
    return this;
  }

  @Override
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }

  // Used by DatumWriter. Applications should not call.
  @Override
  public java.lang.Object get(int field$) {
    switch (field$) {
      case 0: return id;
      case 1: return name;
      case 2: return segment;
      default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /** Writes record to Avro Encoder. */
  public void encode(org.apache.avro.io.Encoder _encoder) throws java.io.IOException {
    _encoder.writeString(id);
    _encoder.writeString(name);
    _encoder.writeArrayStart(); _encoder.setItemCount(segment.size()); for (open_rtb.SegmentAvro e : segment) { e.encode(_encoder); } _encoder.writeArrayEnd(); 
  }

  // Used by DatumReader.  Applications should not call.
  @Override
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    if (_frozen) {
      throw new org.apache.avro.AvroRuntimeException("this Anoa SpecificRecord instance has already been frozen.");
    }
    switch (field$) {
      case 0: id = (org.apache.avro.util.Utf8) value$; break;
      case 1: name = (org.apache.avro.util.Utf8) value$; break;
      case 2: segment = (org.apache.avro.generic.GenericData.Array) value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /** Reads record from Avro Decoder. */
  public DataAvro decode(org.apache.avro.io.Decoder _decoder) throws java.io.IOException {
    if (_frozen) {
      throw new org.apache.avro.AvroRuntimeException("this Anoa SpecificRecord instance has already been frozen.");
    }
    id = _decoder.readString(id);
    name = _decoder.readString(name);
    long _i2 = _decoder.readArrayStart(); segment = new org.apache.avro.generic.GenericData.Array((int) _i2, SCHEMA$.getFields().get(2).schema()); for(; _i2 != 0; _i2 = _decoder.arrayNext()) { for (long _j2= 0; _j2 < _i2; _j2++) { segment.add(new open_rtb.SegmentAvro().decode(_decoder)); } }
    return freeze();
  }

  /**
   * RecordBuilder for Avro instances.
   */
  static public class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase implements org.apache.avro.data.RecordBuilder {

    private org.apache.avro.util.Utf8 id;
    private org.apache.avro.util.Utf8 name;
    private org.apache.avro.generic.GenericData.Array segment;

    public Builder() {
      super(DataAvro.SCHEMA$);
    }

    public Builder(DataAvro.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.name)) {
        this.name = data().deepCopy(fields()[1].schema(), other.name);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.segment)) {
        this.segment = data().deepCopy(fields()[2].schema(), other.segment);
        fieldSetFlags()[2] = true;
      }
    }

    public Builder(DataAvro other) {
      super(DataAvro.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.name)) {
        this.name = data().deepCopy(fields()[1].schema(), other.name);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.segment)) {
        this.segment = data().deepCopy(fields()[2].schema(), other.segment);
        fieldSetFlags()[2] = true;
      }
    }

    /** Gets the value of the 'id' field. */
    public org.apache.avro.util.Utf8 getId() {
      return id;
    }

    /** Sets the value of the 'id' field. */
    public DataAvro.Builder setId(org.apache.avro.util.Utf8 value) {
      validate(fields()[0], value);
      this.id = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /** Checks whether the 'id' field has been set. */
    public boolean hasId() {
      return fieldSetFlags()[0];
    }

    /** Clears the value of the 'id' field. */
    public DataAvro.Builder clearId() {
      id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'name' field. */
    public org.apache.avro.util.Utf8 getName() {
      return name;
    }

    /** Sets the value of the 'name' field. */
    public DataAvro.Builder setName(org.apache.avro.util.Utf8 value) {
      validate(fields()[1], value);
      this.name = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /** Checks whether the 'name' field has been set. */
    public boolean hasName() {
      return fieldSetFlags()[1];
    }

    /** Clears the value of the 'name' field. */
    public DataAvro.Builder clearName() {
      name = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /** Gets the value of the 'segment' field. */
    public org.apache.avro.generic.GenericData.Array getSegment() {
      return segment;
    }

    /** Sets the value of the 'segment' field. */
    public DataAvro.Builder setSegment(org.apache.avro.generic.GenericData.Array value) {
      validate(fields()[2], value);
      this.segment = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /** Checks whether the 'segment' field has been set. */
    public boolean hasSegment() {
      return fieldSetFlags()[2];
    }

    /** Clears the value of the 'segment' field. */
    public DataAvro.Builder clearSegment() {
      segment = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    @Override
    public DataAvro build() {
      final DataAvro record;
      try {
        record = new DataAvro();
        record.id = fieldSetFlags()[0] ? this.id : (org.apache.avro.util.Utf8) defaultValue(fields()[0]);
        record.name = fieldSetFlags()[1] ? this.name : (org.apache.avro.util.Utf8) defaultValue(fields()[1]);
        record.segment = fieldSetFlags()[2] ? this.segment : (org.apache.avro.generic.GenericData.Array) defaultValue(fields()[2]);
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
      return record.freeze();
    }
  }

  /** Creates a new DataAvro RecordBuilder. */
  static public DataAvro.Builder newBuilder() {
    return new DataAvro.Builder();
  }

  /** Creates a new DataAvro RecordBuilder by copying an existing DataAvro.Builder instance. */
  static public DataAvro.Builder newBuilder(DataAvro.Builder other) {
    return new DataAvro.Builder(other);
  }

  /** Creates a new DataAvro RecordBuilder by copying an existing DataAvro instance. */
  static public DataAvro.Builder newBuilder(DataAvro other) {
    return new DataAvro.Builder(other);
  }

  /** Returns Avro record schema. */
  static public org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  static public final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"DataAvro\",\"namespace\":\"open_rtb\",\"doc\":\"3.3.13 Data Object\\nThe data and segment objects together allow data about the user to be passed to bidders in the bid request. This data may be from multiple sources (e.g., the exchange itself, third party providers) as specified by the data object ID field. A bid request can mix data objects from multiple providers.\\nThe data object itself and all of its parameters are optional, so default values are not provided. If an optional parameter is not specified, it should be considered unknown.\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"doc\":\"Exchange specific ID for the data provider.\",\"default\":\"\",\"ordinal_\":1},{\"name\":\"name\",\"type\":\"string\",\"doc\":\"Data provider name.\",\"default\":\"\",\"ordinal_\":2},{\"name\":\"segment\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"SegmentAvro\",\"doc\":\"3.3.14 Segment Object\\nThe data and segment objects together allow data about the user to be passed to bidders in the bid request. Segment objects convey specific units of information from the provider identified in the parent data object.\\nThe segment object itself and all of its parameters are optional, so default values are not provided; if an optional parameter is not specified, it should be considered unknown.\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"doc\":\"ID of a data provider’s segment applicable to the user.\",\"default\":\"\",\"ordinal_\":1},{\"name\":\"name\",\"type\":\"string\",\"doc\":\"Name of a data provider’s segment applicable to the user.\",\"default\":\"\",\"ordinal_\":2},{\"name\":\"value\",\"type\":\"string\",\"doc\":\"String representing the value of the segment. The method for transmitting this data should be negotiated offline with the data provider. For example for gender, “male”, or “female”, for age, “30-40”).\",\"default\":\"\",\"ordinal_\":3}]}},\"doc\":\"Array of segment objects.\",\"default\":[],\"ordinal_\":3}]}");
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy