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

open_rtb.DealAvro 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.17 Direct Deals Object
A “deal” object constitutes a deal struck a priori between a buyer and a seller and indicates that this impression is available under the terms of that deal. */
@org.apache.avro.specific.AvroGenerated
final public class DealAvro extends org.apache.avro.specific.SpecificRecordBase {

  /** A unique identifier for the direct deal. */
  org.apache.avro.util.Utf8 id;
  /** Bid floor for this impression (in CPM of bidfloorcur). */
  double bidfloor;
  /** If bid floor is specified and multiple currencies supported per bid request, then currency should be specified here using ISO- 4217 alphabetic codes. Note, this may be different from bid currency returned by bidder, if this is allowed on an exchange. */
  org.apache.avro.util.Utf8 bidfloorcur;
  /** Array of buyer seats allowed to bid on this Direct Deal. Seats are an optional feature of an exchange. For example, [“4”,”34”,”82”,”45”] indicates that only advertisers using these exchange seats are allowed to bid on this direct deal. */
  org.apache.avro.generic.GenericData.Array wseat;
  /** Array of advertiser domains allowed to bid on this Direct Deal. For example, [“advertiser1.com”,”advertiser2.com”] indicates that only the listed advertisers are allowed to bid on this direct deal. */
  org.apache.avro.generic.GenericData.Array wadomain;
  /** Auction type. If “1”, then first price auction. If “2”, then second price auction. If “3”, the passed bidfloor indicates the apriori agreed upon deal price. Additional auction types can be defined as per the exchange’s business rules. */
  int at;

  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 DealAvro() {}

  public DealAvro freeze() {
    _frozen = true;
    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 bidfloor;
      case 2: return bidfloorcur;
      case 3: return wseat;
      case 4: return wadomain;
      case 5: return at;
      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.writeDouble(bidfloor);
    _encoder.writeString(bidfloorcur);
    _encoder.writeArrayStart(); _encoder.setItemCount(wseat.size()); for (org.apache.avro.util.Utf8 e : wseat) { _encoder.writeString(e); } _encoder.writeArrayEnd(); 
    _encoder.writeArrayStart(); _encoder.setItemCount(wadomain.size()); for (org.apache.avro.util.Utf8 e : wadomain) { _encoder.writeString(e); } _encoder.writeArrayEnd(); 
    _encoder.writeInt(at);
  }

  // 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: bidfloor = (double) value$; break;
      case 2: bidfloorcur = (org.apache.avro.util.Utf8) value$; break;
      case 3: wseat = (org.apache.avro.generic.GenericData.Array) value$; break;
      case 4: wadomain = (org.apache.avro.generic.GenericData.Array) value$; break;
      case 5: at = (int) value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /** Reads record from Avro Decoder. */
  public DealAvro 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);
    bidfloor = _decoder.readDouble();
    bidfloorcur = _decoder.readString(bidfloorcur);
    long _i3 = _decoder.readArrayStart(); wseat = new org.apache.avro.generic.GenericData.Array((int) _i3, SCHEMA$.getFields().get(3).schema()); for(; _i3 != 0; _i3 = _decoder.arrayNext()) { for (long _j3= 0; _j3 < _i3; _j3++) { wseat.add(_decoder.readString(null)); } }
    long _i4 = _decoder.readArrayStart(); wadomain = new org.apache.avro.generic.GenericData.Array((int) _i4, SCHEMA$.getFields().get(4).schema()); for(; _i4 != 0; _i4 = _decoder.arrayNext()) { for (long _j4= 0; _j4 < _i4; _j4++) { wadomain.add(_decoder.readString(null)); } }
    at = _decoder.readInt();
    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 double bidfloor;
    private org.apache.avro.util.Utf8 bidfloorcur;
    private org.apache.avro.generic.GenericData.Array wseat;
    private org.apache.avro.generic.GenericData.Array wadomain;
    private int at;

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

    public Builder(DealAvro.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.bidfloor)) {
        this.bidfloor = data().deepCopy(fields()[1].schema(), other.bidfloor);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.bidfloorcur)) {
        this.bidfloorcur = data().deepCopy(fields()[2].schema(), other.bidfloorcur);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.wseat)) {
        this.wseat = data().deepCopy(fields()[3].schema(), other.wseat);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.wadomain)) {
        this.wadomain = data().deepCopy(fields()[4].schema(), other.wadomain);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.at)) {
        this.at = data().deepCopy(fields()[5].schema(), other.at);
        fieldSetFlags()[5] = true;
      }
    }

    public Builder(DealAvro other) {
      super(DealAvro.SCHEMA$);
      if (isValidValue(fields()[0], other.id)) {
        this.id = data().deepCopy(fields()[0].schema(), other.id);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.bidfloor)) {
        this.bidfloor = data().deepCopy(fields()[1].schema(), other.bidfloor);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.bidfloorcur)) {
        this.bidfloorcur = data().deepCopy(fields()[2].schema(), other.bidfloorcur);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.wseat)) {
        this.wseat = data().deepCopy(fields()[3].schema(), other.wseat);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.wadomain)) {
        this.wadomain = data().deepCopy(fields()[4].schema(), other.wadomain);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.at)) {
        this.at = data().deepCopy(fields()[5].schema(), other.at);
        fieldSetFlags()[5] = 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 DealAvro.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 DealAvro.Builder clearId() {
      id = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /** Gets the value of the 'bidfloor' field. */
    public double getBidfloor() {
      return bidfloor;
    }

    /** Sets the value of the 'bidfloor' field. */
    public DealAvro.Builder setBidfloor(double value) {
      validate(fields()[1], value);
      this.bidfloor = value;
      fieldSetFlags()[1] = true;
      return this;
    }

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

    /** Clears the value of the 'bidfloor' field. */
    public DealAvro.Builder clearBidfloor() {
      fieldSetFlags()[1] = false;
      return this;
    }

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

    /** Sets the value of the 'bidfloorcur' field. */
    public DealAvro.Builder setBidfloorcur(org.apache.avro.util.Utf8 value) {
      validate(fields()[2], value);
      this.bidfloorcur = value;
      fieldSetFlags()[2] = true;
      return this;
    }

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

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

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

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

    /** Checks whether the 'wseat' field has been set. */
    public boolean hasWseat() {
      return fieldSetFlags()[3];
    }

    /** Clears the value of the 'wseat' field. */
    public DealAvro.Builder clearWseat() {
      wseat = null;
      fieldSetFlags()[3] = false;
      return this;
    }

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

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

    /** Checks whether the 'wadomain' field has been set. */
    public boolean hasWadomain() {
      return fieldSetFlags()[4];
    }

    /** Clears the value of the 'wadomain' field. */
    public DealAvro.Builder clearWadomain() {
      wadomain = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /** Gets the value of the 'at' field. */
    public int getAt() {
      return at;
    }

    /** Sets the value of the 'at' field. */
    public DealAvro.Builder setAt(int value) {
      validate(fields()[5], value);
      this.at = value;
      fieldSetFlags()[5] = true;
      return this;
    }

    /** Checks whether the 'at' field has been set. */
    public boolean hasAt() {
      return fieldSetFlags()[5];
    }

    /** Clears the value of the 'at' field. */
    public DealAvro.Builder clearAt() {
      fieldSetFlags()[5] = false;
      return this;
    }

    @Override
    public DealAvro build() {
      final DealAvro record;
      try {
        record = new DealAvro();
        record.id = fieldSetFlags()[0] ? this.id : (org.apache.avro.util.Utf8) defaultValue(fields()[0]);
        record.bidfloor = fieldSetFlags()[1] ? this.bidfloor : (double) defaultValue(fields()[1]);
        record.bidfloorcur = fieldSetFlags()[2] ? this.bidfloorcur : (org.apache.avro.util.Utf8) defaultValue(fields()[2]);
        record.wseat = fieldSetFlags()[3] ? this.wseat : (org.apache.avro.generic.GenericData.Array) defaultValue(fields()[3]);
        record.wadomain = fieldSetFlags()[4] ? this.wadomain : (org.apache.avro.generic.GenericData.Array) defaultValue(fields()[4]);
        record.at = fieldSetFlags()[5] ? this.at : (int) defaultValue(fields()[5]);
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
      return record.freeze();
    }
  }

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

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

  /** Creates a new DealAvro RecordBuilder by copying an existing DealAvro instance. */
  static public DealAvro.Builder newBuilder(DealAvro other) {
    return new DealAvro.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\":\"DealAvro\",\"namespace\":\"open_rtb\",\"doc\":\"3.3.17 Direct Deals Object\\nA “deal” object constitutes a deal struck a priori between a buyer and a seller and indicates that this impression is available under the terms of that deal.\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"doc\":\"A unique identifier for the direct deal.\",\"default\":\"\",\"ordinal_\":1},{\"name\":\"bidfloor\",\"type\":{\"type\":\"double\",\"min\":0.0},\"doc\":\"Bid floor for this impression (in CPM of bidfloorcur).\",\"default\":0.0,\"ordinal_\":2},{\"name\":\"bidfloorcur\",\"type\":\"string\",\"doc\":\"If bid floor is specified and multiple currencies supported per bid request, then currency should be specified here using ISO- 4217 alphabetic codes. Note, this may be different from bid currency returned by bidder, if this is allowed on an exchange.\",\"default\":\"USD\",\"ordinal_\":3},{\"name\":\"wseat\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"doc\":\"Array of buyer seats allowed to bid on this Direct Deal. Seats are an optional feature of an exchange. For example, [“4”,”34”,”82”,”45”] indicates that only advertisers using these exchange seats are allowed to bid on this direct deal.\",\"default\":[],\"ordinal_\":4},{\"name\":\"wadomain\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"doc\":\"Array of advertiser domains allowed to bid on this Direct Deal. For example, [“advertiser1.com”,”advertiser2.com”] indicates that only the listed advertisers are allowed to bid on this direct deal.\",\"default\":[],\"ordinal_\":5},{\"name\":\"at\",\"type\":{\"type\":\"int\",\"max\":255,\"min\":0},\"doc\":\"Auction type. If “1”, then first price auction. If “2”, then second price auction. If “3”, the passed bidfloor indicates the apriori agreed upon deal price. Additional auction types can be defined as per the exchange’s business rules.\",\"default\":0,\"ordinal_\":6}]}");
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy