com.maxmind.geoip2.record.Location Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geoip2 Show documentation
Show all versions of geoip2 Show documentation
GeoIP2 webservice client and database reader
package com.maxmind.geoip2.record;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* Contains data for the location record associated with an IP address.
*
*
* This record is returned by all the end points except the Country end point.
*
*/
public class Location {
@JsonProperty("accuracy_radius")
private Integer accuracyRadius;
@JsonProperty("average_income")
private Integer averageIncome;
@JsonProperty
private Double latitude;
@JsonProperty
private Double longitude;
@JsonProperty("metro_code")
private Integer metroCode;
@JsonProperty("population_density")
private Integer populationDensity;
@JsonProperty("time_zone")
private String timeZone;
/**
* @return The radius in kilometers around the specified location where the
* IP address is likely to be. This attribute is only available from
* the Insights end point.
*/
public Integer getAccuracyRadius() {
return this.accuracyRadius;
}
/**
* @return The average income in US dollars associated with the requested
* IP address. This attribute is only available from the Insights end point.
*/
public Integer getAverageIncome() {
return this.averageIncome;
}
/**
* @return The latitude of the location as a floating point number. This
* attribute is returned by all end points except the Country end
* point.
*/
public Double getLatitude() {
return this.latitude;
}
/**
* @return The longitude of the location as a floating point number. This
* attribute is returned by all end points except the Country end
* point.
*/
public Double getLongitude() {
return this.longitude;
}
/**
* @return The metro code of the location if the location is in the US.
* MaxMind returns the same metro codes as the Google AdWords API. This attribute is returned by all end
* points except the Country end point.
*/
public Integer getMetroCode() {
return this.metroCode;
}
/**
* @return The estimated population per square kilometer associated with the
* IP address. This attribute is only available from the Insights end point.
*/
public Integer getPopulationDensity() {
return this.populationDensity;
}
/**
* @return The time zone associated with location, as specified by the IANA Time Zone
* Database, e.g., "America/New_York". This attribute is
* returned by all end points except the Country end point.
*/
public String getTimeZone() {
return this.timeZone;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Location ["
+ (this.accuracyRadius != null ? "accuracyRadius="
+ this.accuracyRadius + ", " : "")
+ (this.latitude != null ? "latitude=" + this.latitude + ", "
: "")
+ (this.longitude != null ? "longitude=" + this.longitude
+ ", " : "")
+ (this.metroCode != null ? "metroCode=" + this.metroCode
+ ", " : "")
+ (this.timeZone != null ? "timeZone=" + this.timeZone : "")
+ "]";
}
}