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

open_rtb.SegmentAvro 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.14 Segment Object
The 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.
The 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. */
@org.apache.avro.specific.AvroGenerated
final public class SegmentAvro extends org.apache.avro.specific.SpecificRecordBase {

  /** ID of a data provider’s segment applicable to the user. */
  org.apache.avro.util.Utf8 id;
  /** Name of a data provider’s segment applicable to the user. */
  org.apache.avro.util.Utf8 name;
  /** 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”). */
  org.apache.avro.util.Utf8 value;

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

  public SegmentAvro 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 name;
      case 2: return value;
      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.writeString(value);
  }

  // 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: value = (org.apache.avro.util.Utf8) value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /** Reads record from Avro Decoder. */
  public SegmentAvro 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);
    value = _decoder.readString(value);
    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.util.Utf8 value;

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

    public Builder(SegmentAvro.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.value)) {
        this.value = data().deepCopy(fields()[2].schema(), other.value);
        fieldSetFlags()[2] = true;
      }
    }

    public Builder(SegmentAvro other) {
      super(SegmentAvro.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.value)) {
        this.value = data().deepCopy(fields()[2].schema(), other.value);
        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 SegmentAvro.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 SegmentAvro.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 SegmentAvro.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 SegmentAvro.Builder clearName() {
      name = null;
      fieldSetFlags()[1] = false;
      return this;
    }

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

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

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

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

    @Override
    public SegmentAvro build() {
      final SegmentAvro record;
      try {
        record = new SegmentAvro();
        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.value = fieldSetFlags()[2] ? this.value : (org.apache.avro.util.Utf8) defaultValue(fields()[2]);
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
      return record.freeze();
    }
  }

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

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

  /** Creates a new SegmentAvro RecordBuilder by copying an existing SegmentAvro instance. */
  static public SegmentAvro.Builder newBuilder(SegmentAvro other) {
    return new SegmentAvro.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\":\"SegmentAvro\",\"namespace\":\"open_rtb\",\"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}]}");
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy