Record Class CityResponse
java.lang.Object
java.lang.Record
com.maxmind.geoip2.model.CityResponse
- Record Components:
city- City record for the requested IP address.continent- Continent record for the requested IP address.country- Country record for the requested IP address. This object represents the country where MaxMind believes the end user is located.location- Location record for the requested IP address.maxmind- MaxMind record containing data related to your account.postal- Postal record for the requested IP address.registeredCountry- Registered country record for the requested IP address. This record represents the country where the ISP has registered a given IP block and may differ from the user's country.representedCountry- Represented country record for the requested IP address. The represented country is used for things like military bases. It is only present when the represented country differs from the country.subdivisions- AnListofSubdivisionobjects representing the country subdivisions for the requested IP address. The number and type of subdivisions varies by country, but a subdivision is typically a state, province, county, etc. Subdivisions are ordered from most general (largest) to most specific (smallest). If the response did not contain any subdivisions, this is an empty list.traits- Record for the traits of the requested IP address.
- All Implemented Interfaces:
JsonSerializable
public record CityResponse(City city, Continent continent, Country country, Location location, MaxMind maxmind, Postal postal, Country registeredCountry, RepresentedCountry representedCountry, List<Subdivision> subdivisions, Traits traits)
extends Record
implements JsonSerializable
This class provides a model for the data returned by the City Plus web
service and the City database.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCityResponse(CityResponse response, List<String> locales) Constructs an instance ofCityResponsewith the specified parameters.CityResponse(City city, Continent continent, Country country, Location location, MaxMind maxmind, Postal postal, Country registeredCountry, RepresentedCountry representedCountry, List<Subdivision> subdivisions, Traits traits) Compact canonical constructor that sets defaults for null values. -
Method Summary
Modifier and TypeMethodDescriptioncity()Returns the value of thecityrecord component.Returns the value of thecontinentrecord component.country()Returns the value of thecountryrecord component.final booleanIndicates whether some other object is "equal to" this one.getCity()Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Usecontinent()instead.Deprecated, for removal: This API element is subject to removal in a future version.Usecountry()instead.Deprecated, for removal: This API element is subject to removal in a future version.UseleastSpecificSubdivision()instead.Deprecated, for removal: This API element is subject to removal in a future version.Uselocation()instead.Deprecated, for removal: This API element is subject to removal in a future version.Usemaxmind()instead.Deprecated, for removal: This API element is subject to removal in a future version.UsemostSpecificSubdivision()instead.Deprecated, for removal: This API element is subject to removal in a future version.Usepostal()instead.Deprecated, for removal: This API element is subject to removal in a future version.UseregisteredCountry()instead.Deprecated, for removal: This API element is subject to removal in a future version.UserepresentedCountry()instead.Deprecated, for removal: This API element is subject to removal in a future version.Usesubdivisions()instead.Deprecated, for removal: This API element is subject to removal in a future version.Usetraits()instead.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.maxmind()Returns the value of themaxmindrecord component.postal()Returns the value of thepostalrecord component.Returns the value of theregisteredCountryrecord component.Returns the value of therepresentedCountryrecord component.Returns the value of thesubdivisionsrecord component.final StringtoString()Returns a string representation of this record class.traits()Returns the value of thetraitsrecord component.Methods inherited from interface JsonSerializable
toJson
-
Constructor Details
-
CityResponse
-
CityResponse
Constructs an instance ofCityResponsewith the specified parameters.- Parameters:
response- the responselocales- the locales
-
-
Method Details
-
getCity
Deprecated, for removal: This API element is subject to removal in a future version.Usecity()instead. This method will be removed in 6.0.0.- Returns:
- City record for the requested IP address.
-
getContinent
Deprecated, for removal: This API element is subject to removal in a future version.Usecontinent()instead. This method will be removed in 6.0.0.- Returns:
- Continent record for the requested IP address.
-
getCountry
Deprecated, for removal: This API element is subject to removal in a future version.Usecountry()instead. This method will be removed in 6.0.0.- Returns:
- Country record for the requested IP address. This object represents the country where MaxMind believes the end user is located.
-
getLocation
Deprecated, for removal: This API element is subject to removal in a future version.Uselocation()instead. This method will be removed in 6.0.0.- Returns:
- Location record for the requested IP address.
-
getMaxMind
Deprecated, for removal: This API element is subject to removal in a future version.Usemaxmind()instead. This method will be removed in 6.0.0.- Returns:
- MaxMind record containing data related to your account.
-
getPostal
Deprecated, for removal: This API element is subject to removal in a future version.Usepostal()instead. This method will be removed in 6.0.0.- Returns:
- the postal
-
getRegisteredCountry
Deprecated, for removal: This API element is subject to removal in a future version.UseregisteredCountry()instead. This method will be removed in 6.0.0.- Returns:
- Registered country record for the requested IP address. This record represents the country where the ISP has registered a given IP block and may differ from the user's country.
-
getRepresentedCountry
Deprecated, for removal: This API element is subject to removal in a future version.UserepresentedCountry()instead. This method will be removed in 6.0.0.- Returns:
- Represented country record for the requested IP address. The represented country is used for things like military bases. It is only present when the represented country differs from the country.
-
getSubdivisions
Deprecated, for removal: This API element is subject to removal in a future version.Usesubdivisions()instead. This method will be removed in 6.0.0.- Returns:
- An
ListofSubdivisionobjects representing the country subdivisions for the requested IP address. The number and type of subdivisions varies by country, but a subdivision is typically a state, province, county, etc. Subdivisions are ordered from most general (largest) to most specific (smallest). If the response did not contain any subdivisions, this method returns an empty array.
-
getTraits
Deprecated, for removal: This API element is subject to removal in a future version.Usetraits()instead. This method will be removed in 6.0.0.- Returns:
- Record for the traits of the requested IP address.
-
mostSpecificSubdivision
- Returns:
- An object representing the most specific subdivision returned. If
the response did not contain any subdivisions, this method
returns an empty
Subdivisionobject.
-
getMostSpecificSubdivision
Deprecated, for removal: This API element is subject to removal in a future version.UsemostSpecificSubdivision()instead. This method will be removed in 6.0.0.- Returns:
- An object representing the most specific subdivision returned. If
the response did not contain any subdivisions, this method
returns an empty
Subdivisionobject.
-
leastSpecificSubdivision
- Returns:
- An object representing the least specific subdivision returned. If
the response did not contain any subdivisions, this method
returns an empty
Subdivisionobject.
-
getLeastSpecificSubdivision
Deprecated, for removal: This API element is subject to removal in a future version.UseleastSpecificSubdivision()instead. This method will be removed in 6.0.0.- Returns:
- An object representing the least specific subdivision returned. If
the response did not contain any subdivisions, this method
returns an empty
Subdivisionobject.
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
city
-
continent
-
country
-
location
-
maxmind
-
postal
-
registeredCountry
Returns the value of theregisteredCountryrecord component.- Returns:
- the value of the
registeredCountryrecord component
-
representedCountry
Returns the value of therepresentedCountryrecord component.- Returns:
- the value of the
representedCountryrecord component
-
subdivisions
Returns the value of thesubdivisionsrecord component.- Returns:
- the value of the
subdivisionsrecord component
-
traits
-
city()instead.