
open_rtb.UserAvro Maven / Gradle / Ivy
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package open_rtb;
/** 3.3.12 User Object
The “user” object contains information known or derived about the human user of the device. Note that the user ID is an exchange artifact (refer to the “device” object for hardware or platform derived IDs) and may be subject to rotation policies. However, this user ID must be stable long enough to serve reasonably as the basis for frequency capping.
The user 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.
If device ID is used as a proxy for unique user ID, use the device object. */
@org.apache.avro.specific.AvroGenerated
final public class UserAvro extends org.apache.avro.specific.SpecificRecordBase {
/** Unique consumer ID of this user on the exchange. */
org.apache.avro.util.Utf8 id;
/** Buyer’s user ID for this user as mapped by exchange for the buyer. (AdGear cookie) */
org.apache.avro.util.Utf8 buyeruid;
/** Year of birth as a 4-digit integer. */
int yob;
/** Gender as “M” male, “F” female, “O” Other. (Null indicates unknown). */
org.apache.avro.util.Utf8 gender;
/** Comma separated list of keywords of consumer interests or intent. */
org.apache.avro.util.Utf8 keywords;
/** If supported by the exchange, this is custom data that the bidder had stored in the exchange’s cookie. The string may be in base85 cookie safe characters, and be in any format. This may useful for storing user features. Note: Proper JSON encoding must be used to include “escaped” quotation marks. */
org.apache.avro.util.Utf8 customdata;
/** Home geo for the user (e.g., based off of registration data); this is different from the current location of the access device (that is defined by the geo object embedded in the Device Object); see Geo Object. */
open_rtb.GeoAvro geo;
/** See Data Object. */
org.apache.avro.generic.GenericData.Array data;
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 UserAvro() {}
public UserAvro freeze() {
_frozen = true;
geo.freeze();
data.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 buyeruid;
case 2: return yob;
case 3: return gender;
case 4: return keywords;
case 5: return customdata;
case 6: return geo;
case 7: return data;
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(buyeruid);
_encoder.writeInt(yob);
_encoder.writeString(gender);
_encoder.writeString(keywords);
_encoder.writeString(customdata);
geo.encode(_encoder);
_encoder.writeArrayStart(); _encoder.setItemCount(data.size()); for (open_rtb.DataAvro e : data) { 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: buyeruid = (org.apache.avro.util.Utf8) value$; break;
case 2: yob = (int) value$; break;
case 3: gender = (org.apache.avro.util.Utf8) value$; break;
case 4: keywords = (org.apache.avro.util.Utf8) value$; break;
case 5: customdata = (org.apache.avro.util.Utf8) value$; break;
case 6: geo = (open_rtb.GeoAvro) value$; break;
case 7: data = (org.apache.avro.generic.GenericData.Array) value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/** Reads record from Avro Decoder. */
public UserAvro 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);
buyeruid = _decoder.readString(buyeruid);
yob = _decoder.readInt();
gender = _decoder.readString(gender);
keywords = _decoder.readString(keywords);
customdata = _decoder.readString(customdata);
geo = java.util.Optional.ofNullable(geo).orElseGet(open_rtb.GeoAvro::new).decode(_decoder);
long _i7 = _decoder.readArrayStart(); data = new org.apache.avro.generic.GenericData.Array((int) _i7, SCHEMA$.getFields().get(7).schema()); for(; _i7 != 0; _i7 = _decoder.arrayNext()) { for (long _j7= 0; _j7 < _i7; _j7++) { data.add(new open_rtb.DataAvro().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 buyeruid;
private int yob;
private org.apache.avro.util.Utf8 gender;
private org.apache.avro.util.Utf8 keywords;
private org.apache.avro.util.Utf8 customdata;
private open_rtb.GeoAvro geo;
private org.apache.avro.generic.GenericData.Array data;
public Builder() {
super(UserAvro.SCHEMA$);
}
public Builder(UserAvro.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.buyeruid)) {
this.buyeruid = data().deepCopy(fields()[1].schema(), other.buyeruid);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.yob)) {
this.yob = data().deepCopy(fields()[2].schema(), other.yob);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.gender)) {
this.gender = data().deepCopy(fields()[3].schema(), other.gender);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.keywords)) {
this.keywords = data().deepCopy(fields()[4].schema(), other.keywords);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.customdata)) {
this.customdata = data().deepCopy(fields()[5].schema(), other.customdata);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.geo)) {
this.geo = data().deepCopy(fields()[6].schema(), other.geo);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.data)) {
this.data = data().deepCopy(fields()[7].schema(), other.data);
fieldSetFlags()[7] = true;
}
}
public Builder(UserAvro other) {
super(UserAvro.SCHEMA$);
if (isValidValue(fields()[0], other.id)) {
this.id = data().deepCopy(fields()[0].schema(), other.id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.buyeruid)) {
this.buyeruid = data().deepCopy(fields()[1].schema(), other.buyeruid);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.yob)) {
this.yob = data().deepCopy(fields()[2].schema(), other.yob);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.gender)) {
this.gender = data().deepCopy(fields()[3].schema(), other.gender);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.keywords)) {
this.keywords = data().deepCopy(fields()[4].schema(), other.keywords);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.customdata)) {
this.customdata = data().deepCopy(fields()[5].schema(), other.customdata);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.geo)) {
this.geo = data().deepCopy(fields()[6].schema(), other.geo);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.data)) {
this.data = data().deepCopy(fields()[7].schema(), other.data);
fieldSetFlags()[7] = 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 UserAvro.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 UserAvro.Builder clearId() {
id = null;
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'buyeruid' field. */
public org.apache.avro.util.Utf8 getBuyeruid() {
return buyeruid;
}
/** Sets the value of the 'buyeruid' field. */
public UserAvro.Builder setBuyeruid(org.apache.avro.util.Utf8 value) {
validate(fields()[1], value);
this.buyeruid = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'buyeruid' field has been set. */
public boolean hasBuyeruid() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'buyeruid' field. */
public UserAvro.Builder clearBuyeruid() {
buyeruid = null;
fieldSetFlags()[1] = false;
return this;
}
/** Gets the value of the 'yob' field. */
public int getYob() {
return yob;
}
/** Sets the value of the 'yob' field. */
public UserAvro.Builder setYob(int value) {
validate(fields()[2], value);
this.yob = value;
fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'yob' field has been set. */
public boolean hasYob() {
return fieldSetFlags()[2];
}
/** Clears the value of the 'yob' field. */
public UserAvro.Builder clearYob() {
fieldSetFlags()[2] = false;
return this;
}
/** Gets the value of the 'gender' field. */
public org.apache.avro.util.Utf8 getGender() {
return gender;
}
/** Sets the value of the 'gender' field. */
public UserAvro.Builder setGender(org.apache.avro.util.Utf8 value) {
validate(fields()[3], value);
this.gender = value;
fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'gender' field has been set. */
public boolean hasGender() {
return fieldSetFlags()[3];
}
/** Clears the value of the 'gender' field. */
public UserAvro.Builder clearGender() {
gender = null;
fieldSetFlags()[3] = false;
return this;
}
/** Gets the value of the 'keywords' field. */
public org.apache.avro.util.Utf8 getKeywords() {
return keywords;
}
/** Sets the value of the 'keywords' field. */
public UserAvro.Builder setKeywords(org.apache.avro.util.Utf8 value) {
validate(fields()[4], value);
this.keywords = value;
fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'keywords' field has been set. */
public boolean hasKeywords() {
return fieldSetFlags()[4];
}
/** Clears the value of the 'keywords' field. */
public UserAvro.Builder clearKeywords() {
keywords = null;
fieldSetFlags()[4] = false;
return this;
}
/** Gets the value of the 'customdata' field. */
public org.apache.avro.util.Utf8 getCustomdata() {
return customdata;
}
/** Sets the value of the 'customdata' field. */
public UserAvro.Builder setCustomdata(org.apache.avro.util.Utf8 value) {
validate(fields()[5], value);
this.customdata = value;
fieldSetFlags()[5] = true;
return this;
}
/** Checks whether the 'customdata' field has been set. */
public boolean hasCustomdata() {
return fieldSetFlags()[5];
}
/** Clears the value of the 'customdata' field. */
public UserAvro.Builder clearCustomdata() {
customdata = null;
fieldSetFlags()[5] = false;
return this;
}
/** Gets the value of the 'geo' field. */
public open_rtb.GeoAvro getGeo() {
return geo;
}
/** Sets the value of the 'geo' field. */
public UserAvro.Builder setGeo(open_rtb.GeoAvro value) {
validate(fields()[6], value);
this.geo = value;
fieldSetFlags()[6] = true;
return this;
}
/** Checks whether the 'geo' field has been set. */
public boolean hasGeo() {
return fieldSetFlags()[6];
}
/** Clears the value of the 'geo' field. */
public UserAvro.Builder clearGeo() {
geo = null;
fieldSetFlags()[6] = false;
return this;
}
/** Gets the value of the 'data' field. */
public org.apache.avro.generic.GenericData.Array getData() {
return data;
}
/** Sets the value of the 'data' field. */
public UserAvro.Builder setData(org.apache.avro.generic.GenericData.Array value) {
validate(fields()[7], value);
this.data = value;
fieldSetFlags()[7] = true;
return this;
}
/** Checks whether the 'data' field has been set. */
public boolean hasData() {
return fieldSetFlags()[7];
}
/** Clears the value of the 'data' field. */
public UserAvro.Builder clearData() {
data = null;
fieldSetFlags()[7] = false;
return this;
}
@Override
public UserAvro build() {
final UserAvro record;
try {
record = new UserAvro();
record.id = fieldSetFlags()[0] ? this.id : (org.apache.avro.util.Utf8) defaultValue(fields()[0]);
record.buyeruid = fieldSetFlags()[1] ? this.buyeruid : (org.apache.avro.util.Utf8) defaultValue(fields()[1]);
record.yob = fieldSetFlags()[2] ? this.yob : (int) defaultValue(fields()[2]);
record.gender = fieldSetFlags()[3] ? this.gender : (org.apache.avro.util.Utf8) defaultValue(fields()[3]);
record.keywords = fieldSetFlags()[4] ? this.keywords : (org.apache.avro.util.Utf8) defaultValue(fields()[4]);
record.customdata = fieldSetFlags()[5] ? this.customdata : (org.apache.avro.util.Utf8) defaultValue(fields()[5]);
record.geo = fieldSetFlags()[6] ? this.geo : (open_rtb.GeoAvro) defaultValue(fields()[6]);
record.data = fieldSetFlags()[7] ? this.data : (org.apache.avro.generic.GenericData.Array) defaultValue(fields()[7]);
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
return record.freeze();
}
}
/** Creates a new UserAvro RecordBuilder. */
static public UserAvro.Builder newBuilder() {
return new UserAvro.Builder();
}
/** Creates a new UserAvro RecordBuilder by copying an existing UserAvro.Builder instance. */
static public UserAvro.Builder newBuilder(UserAvro.Builder other) {
return new UserAvro.Builder(other);
}
/** Creates a new UserAvro RecordBuilder by copying an existing UserAvro instance. */
static public UserAvro.Builder newBuilder(UserAvro other) {
return new UserAvro.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\":\"UserAvro\",\"namespace\":\"open_rtb\",\"doc\":\"3.3.12 User Object\\nThe “user” object contains information known or derived about the human user of the device. Note that the user ID is an exchange artifact (refer to the “device” object for hardware or platform derived IDs) and may be subject to rotation policies. However, this user ID must be stable long enough to serve reasonably as the basis for frequency capping.\\nThe user 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.\\nIf device ID is used as a proxy for unique user ID, use the device object.\",\"fields\":[{\"name\":\"id\",\"type\":\"string\",\"doc\":\"Unique consumer ID of this user on the exchange.\",\"default\":\"\",\"ordinal_\":1},{\"name\":\"buyeruid\",\"type\":\"string\",\"doc\":\"Buyer’s user ID for this user as mapped by exchange for the buyer. (AdGear cookie)\",\"default\":\"\",\"ordinal_\":2},{\"name\":\"yob\",\"type\":{\"type\":\"int\",\"max\":9999,\"min\":0},\"doc\":\"Year of birth as a 4-digit integer.\",\"default\":0,\"ordinal_\":3},{\"name\":\"gender\",\"type\":\"string\",\"doc\":\"Gender as “M” male, “F” female, “O” Other. (Null indicates unknown).\",\"default\":\"\",\"ordinal_\":4},{\"name\":\"keywords\",\"type\":\"string\",\"doc\":\"Comma separated list of keywords of consumer interests or intent.\",\"default\":\"\",\"ordinal_\":5},{\"name\":\"customdata\",\"type\":\"string\",\"doc\":\"If supported by the exchange, this is custom data that the bidder had stored in the exchange’s cookie. The string may be in base85 cookie safe characters, and be in any format. This may useful for storing user features. Note: Proper JSON encoding must be used to include “escaped” quotation marks.\",\"default\":\"\",\"ordinal_\":6},{\"name\":\"geo\",\"type\":{\"type\":\"record\",\"name\":\"GeoAvro\",\"doc\":\"3.3.11 Geo Object\\nThe geo 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.\\nNote that the Geo Object may appear in one or both the Device Object and the User Object. This is intentional, since the information may be derived from either a device-oriented source (such as IP geo lookup), or by user registration information (for example provided to a publisher through a user registration). If the information is in conflict, it’s up to the bidder to determine which information to use.\",\"fields\":[{\"name\":\"lat\",\"type\":{\"type\":\"float\",\"max\":90.0,\"min\":-90.0,\"mantissa\":23},\"doc\":\"Latitude from -90 to 90. South is negative. This should only be passed if known to be accurate (For example, not the centroid of a postal code).\",\"default\":0.0,\"ordinal_\":1},{\"name\":\"lon\",\"type\":{\"type\":\"float\",\"max\":180.0,\"min\":-180.0,\"mantissa\":23},\"doc\":\"Longitude from -180 to 180. West is negative. This should only be passed if known to be accurate.\",\"default\":0.0,\"ordinal_\":2},{\"name\":\"country\",\"type\":\"string\",\"doc\":\"Country using ISO-3166-1 Alpha-3.\",\"default\":\"\",\"ordinal_\":3},{\"name\":\"region\",\"type\":\"string\",\"doc\":\"Region using ISO 3166-2.\",\"default\":\"\",\"ordinal_\":4},{\"name\":\"regionfips104\",\"type\":\"string\",\"doc\":\"Region of a country using FIPS 10-4 notation (alternative to ISO 3166-2).\",\"default\":\"\",\"ordinal_\":5},{\"name\":\"metro\",\"type\":\"string\",\"doc\":\"Pass the metro code (seehttp://code.google.com/apis/adwords/docs/appendix/metrocodes.html). Metro codes are similar to but not exactly the same as Nielsen DMAs.\",\"default\":\"\",\"ordinal_\":6},{\"name\":\"city\",\"type\":\"string\",\"doc\":\"City using United Nations Code for Trade and Transport Locations (http://www.unece.org/cefact/locode/ser vice/location.htm).\",\"default\":\"\",\"ordinal_\":7},{\"name\":\"zip\",\"type\":\"string\",\"doc\":\"Zip/postal code.\",\"default\":\"\",\"ordinal_\":8},{\"name\":\"type\",\"type\":{\"type\":\"int\",\"max\":255,\"min\":0},\"doc\":\"Indicate the source of the geo data (GPS, IP address, user provided). See Table 6.15 Location Type for a list of potential values. Type should be provided when lat/lon is provided.\",\"default\":0,\"ordinal_\":9}]},\"doc\":\"Home geo for the user (e.g., based off of registration data); this is different from the current location of the access device (that is defined by the geo object embedded in the Device Object); see Geo Object.\",\"default\":{},\"ordinal_\":7},{\"name\":\"data\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"DataAvro\",\"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}]}},\"doc\":\"See Data Object.\",\"default\":[],\"ordinal_\":8}]}");
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy