Class Location


  • public class Location
    extends Object

    This class represents a location along with a range of 'names' which apply to it, such as countries, cities, postalCodes etc.

    The available fields are based closely on the MaxMind2 data.

    Since:
    13.0
    • Field Detail

      • city

        private final String city
        The city name of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • countryCode

        private final String countryCode
        The two letter country code (ISO 3166-1 alpha code) of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • countryName

        private final String countryName
        The full country name of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • countryGeoNameId

        private final Integer countryGeoNameId
        The GeoName ID of the country.
        Since:
        15.24
      • latitude

        private final Double latitude

        The latitude of the represented location.

        Defaults to zero if it cannot be determined even though that represents a legitimate location.

        Since:
        13.0
      • longitude

        private final Double longitude

        The longitude of the represented location.

        Defaults to zero if it cannot be determined even though that represents a legitimate location.

        Since:
        13.0
      • metroCode

        private final Integer metroCode
        The metro code of the represented location if it can be determined, otherwise zero.
        Since:
        13.0
      • postalCode

        private final String postalCode
        The postal code of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • subdivisions

        private final List<Location.Subdivision> subdivisions
        The subdivisions of the location. This will generally hold the sate or province the location is in, however it depends on on the particular country. Some locations may have multiple subdivisions. The order is from the least specific to most specific division.
        Since:
        15.24
    • Method Detail

      • getCity

        public String getCity()
        The city name of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • getCountryCode

        public String getCountryCode()
        The two letter country code (ISO 3166-1 alpha code) of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • getCountryName

        public String getCountryName()
        The full country name of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • getCountryGeoNameId

        public Integer getCountryGeoNameId()
        The GeoName ID of the country.
        Since:
        15.24
      • getLatitude

        public Double getLatitude()

        The latitude of the represented location.

        Defaults to zero if it cannot be determined even though that represents a legitimate location.

        Since:
        13.0
      • getLongitude

        public Double getLongitude()

        The longitude of the represented location.

        Defaults to zero if it cannot be determined even though that represents a legitimate location.

        Since:
        13.0
      • getMetroCode

        public Integer getMetroCode()
        The metro code of the represented location if it can be determined, otherwise zero.
        Since:
        13.0
      • getPostalCode

        public String getPostalCode()
        The postal code of the represented location if it can be determined, otherwise null.
        Since:
        13.0
      • getSubdivisions

        public List<Location.Subdivision> getSubdivisions()
        The subdivisions of the location. This will generally hold the sate or province the location is in, however it depends on on the particular country. Some locations may have multiple subdivisions. The order is from the least specific to most specific division.
        Since:
        15.24
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object