Record Class Location

java.lang.Object
java.lang.Record
com.maxmind.geoip2.record.Location
Record Components:
accuracyRadius - The approximate accuracy radius in kilometers around the latitude and longitude for the IP address. This is the radius where we have a 67% confidence that the device using the IP address resides within the circle centered at the latitude and longitude with the provided radius.
averageIncome - The average income in US dollars associated with the requested IP address. This attribute is only available from the Insights web service.
latitude - The approximate latitude of the location associated with the IP address. This value is not precise and should not be used to identify a particular address or household.
longitude - The approximate longitude of the location associated with the IP address. This value is not precise and should not be used to identify a particular address or household.
populationDensity - The estimated population per square kilometer associated with the IP address. This attribute is only available from the Insights web service.
timeZone - The time zone associated with location, as specified by the IANA Time Zone Database, e.g., "America/New_York".
All Implemented Interfaces:
JsonSerializable

public record Location(Integer accuracyRadius, Integer averageIncome, Double latitude, Double longitude, Integer populationDensity, String timeZone) extends Record implements JsonSerializable

Contains data for the location record associated with an IP address.

  • Constructor Details

    • Location

      public Location()
      Constructs a Location record with null values for all the fields.
    • Location

      public Location(Integer accuracyRadius, Integer averageIncome, Double latitude, Double longitude, Integer populationDensity, String timeZone)
      Creates an instance of a Location record class.
      Parameters:
      accuracyRadius - the value for the accuracyRadius record component
      averageIncome - the value for the averageIncome record component
      latitude - the value for the latitude record component
      longitude - the value for the longitude record component
      populationDensity - the value for the populationDensity record component
      timeZone - the value for the timeZone record component
  • Method Details

    • getAverageIncome

      @Deprecated(since="5.0.0", forRemoval=true) public Integer getAverageIncome()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use averageIncome() instead. This method will be removed in 6.0.0.
      Returns:
      The average income in US dollars associated with the requested IP address. This attribute is only available from the Insights web service.
    • getPopulationDensity

      @Deprecated(since="5.0.0", forRemoval=true) public Integer getPopulationDensity()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use populationDensity() instead. This method will be removed in 6.0.0.
      Returns:
      The estimated population per square kilometer associated with the IP address. This attribute is only available from the Insights web service.
    • getTimeZone

      @Deprecated(since="5.0.0", forRemoval=true) public String getTimeZone()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use timeZone() instead. This method will be removed in 6.0.0.
      Returns:
      The time zone associated with location, as specified by the IANA Time Zone Database, e.g., "America/New_York".
    • getAccuracyRadius

      @Deprecated(since="5.0.0", forRemoval=true) public Integer getAccuracyRadius()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use accuracyRadius() instead. This method will be removed in 6.0.0.
      Returns:
      The approximate accuracy radius in kilometers around the latitude and longitude for the IP address. This is the radius where we have a 67% confidence that the device using the IP address resides within the circle centered at the latitude and longitude with the provided radius.
    • getLatitude

      @Deprecated(since="5.0.0", forRemoval=true) public Double getLatitude()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use latitude() instead. This method will be removed in 6.0.0.
      Returns:
      The approximate latitude of the location associated with the IP address. This value is not precise and should not be used to identify a particular address or household.
    • getLongitude

      @Deprecated(since="5.0.0", forRemoval=true) public Double getLongitude()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use longitude() instead. This method will be removed in 6.0.0.
      Returns:
      The approximate longitude of the location associated with the IP address. This value is not precise and should not be used to identify a particular address or household.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • accuracyRadius

      public Integer accuracyRadius()
      Returns the value of the accuracyRadius record component.
      Returns:
      the value of the accuracyRadius record component
    • averageIncome

      public Integer averageIncome()
      Returns the value of the averageIncome record component.
      Returns:
      the value of the averageIncome record component
    • latitude

      public Double latitude()
      Returns the value of the latitude record component.
      Returns:
      the value of the latitude record component
    • longitude

      public Double longitude()
      Returns the value of the longitude record component.
      Returns:
      the value of the longitude record component
    • populationDensity

      public Integer populationDensity()
      Returns the value of the populationDensity record component.
      Returns:
      the value of the populationDensity record component
    • timeZone

      public String timeZone()
      Returns the value of the timeZone record component.
      Returns:
      the value of the timeZone record component