
open_rtb.GeoAvro Maven / Gradle / Ivy
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package open_rtb;
/** 3.3.11 Geo Object
The 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.
Note 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. */
@org.apache.avro.specific.AvroGenerated
final public class GeoAvro extends org.apache.avro.specific.SpecificRecordBase {
/** 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). */
float lat;
/** Longitude from -180 to 180. West is negative. This should only be passed if known to be accurate. */
float lon;
/** Country using ISO-3166-1 Alpha-3. */
org.apache.avro.util.Utf8 country;
/** Region using ISO 3166-2. */
org.apache.avro.util.Utf8 region;
/** Region of a country using FIPS 10-4 notation (alternative to ISO 3166-2). */
org.apache.avro.util.Utf8 regionfips104;
/** 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. */
org.apache.avro.util.Utf8 metro;
/** City using United Nations Code for Trade and Transport Locations (http://www.unece.org/cefact/locode/ser vice/location.htm). */
org.apache.avro.util.Utf8 city;
/** Zip/postal code. */
org.apache.avro.util.Utf8 zip;
/** 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. */
int type;
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 GeoAvro() {}
public GeoAvro 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 lat;
case 1: return lon;
case 2: return country;
case 3: return region;
case 4: return regionfips104;
case 5: return metro;
case 6: return city;
case 7: return zip;
case 8: return type;
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.writeFloat(lat);
_encoder.writeFloat(lon);
_encoder.writeString(country);
_encoder.writeString(region);
_encoder.writeString(regionfips104);
_encoder.writeString(metro);
_encoder.writeString(city);
_encoder.writeString(zip);
_encoder.writeInt(type);
}
// 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: lat = (float) value$; break;
case 1: lon = (float) value$; break;
case 2: country = (org.apache.avro.util.Utf8) value$; break;
case 3: region = (org.apache.avro.util.Utf8) value$; break;
case 4: regionfips104 = (org.apache.avro.util.Utf8) value$; break;
case 5: metro = (org.apache.avro.util.Utf8) value$; break;
case 6: city = (org.apache.avro.util.Utf8) value$; break;
case 7: zip = (org.apache.avro.util.Utf8) value$; break;
case 8: type = (int) value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/** Reads record from Avro Decoder. */
public GeoAvro 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.");
}
lat = _decoder.readFloat();
lon = _decoder.readFloat();
country = _decoder.readString(country);
region = _decoder.readString(region);
regionfips104 = _decoder.readString(regionfips104);
metro = _decoder.readString(metro);
city = _decoder.readString(city);
zip = _decoder.readString(zip);
type = _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 float lat;
private float lon;
private org.apache.avro.util.Utf8 country;
private org.apache.avro.util.Utf8 region;
private org.apache.avro.util.Utf8 regionfips104;
private org.apache.avro.util.Utf8 metro;
private org.apache.avro.util.Utf8 city;
private org.apache.avro.util.Utf8 zip;
private int type;
public Builder() {
super(GeoAvro.SCHEMA$);
}
public Builder(GeoAvro.Builder other) {
super(other);
if (isValidValue(fields()[0], other.lat)) {
this.lat = data().deepCopy(fields()[0].schema(), other.lat);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.lon)) {
this.lon = data().deepCopy(fields()[1].schema(), other.lon);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.country)) {
this.country = data().deepCopy(fields()[2].schema(), other.country);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.region)) {
this.region = data().deepCopy(fields()[3].schema(), other.region);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.regionfips104)) {
this.regionfips104 = data().deepCopy(fields()[4].schema(), other.regionfips104);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.metro)) {
this.metro = data().deepCopy(fields()[5].schema(), other.metro);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.city)) {
this.city = data().deepCopy(fields()[6].schema(), other.city);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.zip)) {
this.zip = data().deepCopy(fields()[7].schema(), other.zip);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.type)) {
this.type = data().deepCopy(fields()[8].schema(), other.type);
fieldSetFlags()[8] = true;
}
}
public Builder(GeoAvro other) {
super(GeoAvro.SCHEMA$);
if (isValidValue(fields()[0], other.lat)) {
this.lat = data().deepCopy(fields()[0].schema(), other.lat);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.lon)) {
this.lon = data().deepCopy(fields()[1].schema(), other.lon);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.country)) {
this.country = data().deepCopy(fields()[2].schema(), other.country);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.region)) {
this.region = data().deepCopy(fields()[3].schema(), other.region);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.regionfips104)) {
this.regionfips104 = data().deepCopy(fields()[4].schema(), other.regionfips104);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.metro)) {
this.metro = data().deepCopy(fields()[5].schema(), other.metro);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.city)) {
this.city = data().deepCopy(fields()[6].schema(), other.city);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.zip)) {
this.zip = data().deepCopy(fields()[7].schema(), other.zip);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.type)) {
this.type = data().deepCopy(fields()[8].schema(), other.type);
fieldSetFlags()[8] = true;
}
}
/** Gets the value of the 'lat' field. */
public float getLat() {
return lat;
}
/** Sets the value of the 'lat' field. */
public GeoAvro.Builder setLat(float value) {
validate(fields()[0], value);
this.lat = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'lat' field has been set. */
public boolean hasLat() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'lat' field. */
public GeoAvro.Builder clearLat() {
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'lon' field. */
public float getLon() {
return lon;
}
/** Sets the value of the 'lon' field. */
public GeoAvro.Builder setLon(float value) {
validate(fields()[1], value);
this.lon = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'lon' field has been set. */
public boolean hasLon() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'lon' field. */
public GeoAvro.Builder clearLon() {
fieldSetFlags()[1] = false;
return this;
}
/** Gets the value of the 'country' field. */
public org.apache.avro.util.Utf8 getCountry() {
return country;
}
/** Sets the value of the 'country' field. */
public GeoAvro.Builder setCountry(org.apache.avro.util.Utf8 value) {
validate(fields()[2], value);
this.country = value;
fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'country' field has been set. */
public boolean hasCountry() {
return fieldSetFlags()[2];
}
/** Clears the value of the 'country' field. */
public GeoAvro.Builder clearCountry() {
country = null;
fieldSetFlags()[2] = false;
return this;
}
/** Gets the value of the 'region' field. */
public org.apache.avro.util.Utf8 getRegion() {
return region;
}
/** Sets the value of the 'region' field. */
public GeoAvro.Builder setRegion(org.apache.avro.util.Utf8 value) {
validate(fields()[3], value);
this.region = value;
fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'region' field has been set. */
public boolean hasRegion() {
return fieldSetFlags()[3];
}
/** Clears the value of the 'region' field. */
public GeoAvro.Builder clearRegion() {
region = null;
fieldSetFlags()[3] = false;
return this;
}
/** Gets the value of the 'regionfips104' field. */
public org.apache.avro.util.Utf8 getRegionfips104() {
return regionfips104;
}
/** Sets the value of the 'regionfips104' field. */
public GeoAvro.Builder setRegionfips104(org.apache.avro.util.Utf8 value) {
validate(fields()[4], value);
this.regionfips104 = value;
fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'regionfips104' field has been set. */
public boolean hasRegionfips104() {
return fieldSetFlags()[4];
}
/** Clears the value of the 'regionfips104' field. */
public GeoAvro.Builder clearRegionfips104() {
regionfips104 = null;
fieldSetFlags()[4] = false;
return this;
}
/** Gets the value of the 'metro' field. */
public org.apache.avro.util.Utf8 getMetro() {
return metro;
}
/** Sets the value of the 'metro' field. */
public GeoAvro.Builder setMetro(org.apache.avro.util.Utf8 value) {
validate(fields()[5], value);
this.metro = value;
fieldSetFlags()[5] = true;
return this;
}
/** Checks whether the 'metro' field has been set. */
public boolean hasMetro() {
return fieldSetFlags()[5];
}
/** Clears the value of the 'metro' field. */
public GeoAvro.Builder clearMetro() {
metro = null;
fieldSetFlags()[5] = false;
return this;
}
/** Gets the value of the 'city' field. */
public org.apache.avro.util.Utf8 getCity() {
return city;
}
/** Sets the value of the 'city' field. */
public GeoAvro.Builder setCity(org.apache.avro.util.Utf8 value) {
validate(fields()[6], value);
this.city = value;
fieldSetFlags()[6] = true;
return this;
}
/** Checks whether the 'city' field has been set. */
public boolean hasCity() {
return fieldSetFlags()[6];
}
/** Clears the value of the 'city' field. */
public GeoAvro.Builder clearCity() {
city = null;
fieldSetFlags()[6] = false;
return this;
}
/** Gets the value of the 'zip' field. */
public org.apache.avro.util.Utf8 getZip() {
return zip;
}
/** Sets the value of the 'zip' field. */
public GeoAvro.Builder setZip(org.apache.avro.util.Utf8 value) {
validate(fields()[7], value);
this.zip = value;
fieldSetFlags()[7] = true;
return this;
}
/** Checks whether the 'zip' field has been set. */
public boolean hasZip() {
return fieldSetFlags()[7];
}
/** Clears the value of the 'zip' field. */
public GeoAvro.Builder clearZip() {
zip = null;
fieldSetFlags()[7] = false;
return this;
}
/** Gets the value of the 'type' field. */
public int getType() {
return type;
}
/** Sets the value of the 'type' field. */
public GeoAvro.Builder setType(int value) {
validate(fields()[8], value);
this.type = value;
fieldSetFlags()[8] = true;
return this;
}
/** Checks whether the 'type' field has been set. */
public boolean hasType() {
return fieldSetFlags()[8];
}
/** Clears the value of the 'type' field. */
public GeoAvro.Builder clearType() {
fieldSetFlags()[8] = false;
return this;
}
@Override
public GeoAvro build() {
final GeoAvro record;
try {
record = new GeoAvro();
record.lat = fieldSetFlags()[0] ? this.lat : (float) defaultValue(fields()[0]);
record.lon = fieldSetFlags()[1] ? this.lon : (float) defaultValue(fields()[1]);
record.country = fieldSetFlags()[2] ? this.country : (org.apache.avro.util.Utf8) defaultValue(fields()[2]);
record.region = fieldSetFlags()[3] ? this.region : (org.apache.avro.util.Utf8) defaultValue(fields()[3]);
record.regionfips104 = fieldSetFlags()[4] ? this.regionfips104 : (org.apache.avro.util.Utf8) defaultValue(fields()[4]);
record.metro = fieldSetFlags()[5] ? this.metro : (org.apache.avro.util.Utf8) defaultValue(fields()[5]);
record.city = fieldSetFlags()[6] ? this.city : (org.apache.avro.util.Utf8) defaultValue(fields()[6]);
record.zip = fieldSetFlags()[7] ? this.zip : (org.apache.avro.util.Utf8) defaultValue(fields()[7]);
record.type = fieldSetFlags()[8] ? this.type : (int) defaultValue(fields()[8]);
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
return record.freeze();
}
}
/** Creates a new GeoAvro RecordBuilder. */
static public GeoAvro.Builder newBuilder() {
return new GeoAvro.Builder();
}
/** Creates a new GeoAvro RecordBuilder by copying an existing GeoAvro.Builder instance. */
static public GeoAvro.Builder newBuilder(GeoAvro.Builder other) {
return new GeoAvro.Builder(other);
}
/** Creates a new GeoAvro RecordBuilder by copying an existing GeoAvro instance. */
static public GeoAvro.Builder newBuilder(GeoAvro other) {
return new GeoAvro.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\":\"GeoAvro\",\"namespace\":\"open_rtb\",\"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}]}");
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy