Record Class Country
java.lang.Object
java.lang.Record
com.maxmind.geoip2.record.Country
- Record Components:
locales- The locales to use for retrieving localized names.confidence- A value from 0-100 indicating MaxMind's confidence that the country is correct. This attribute is only available from the Insights web service and the GeoIP2 Enterprise database.geonameId- The GeoName ID for the country.isInEuropeanUnion- This is true if the country is a member state of the European Union.isoCode- The two-character ISO 3166-1 alpha code for the country.names- AMapfrom locale codes to the name in that locale.
- All Implemented Interfaces:
JsonSerializable, NamedRecord
public record Country(List<String> locales, Integer confidence, Long geonameId, boolean isInEuropeanUnion, String isoCode, Map<String,String> names)
extends Record
implements NamedRecord
Contains data for the country record associated with an IP address.
Do not use any of the country names as a database or map key. Use the value
returned by geonameId() or isoCode() instead.
-
Constructor Summary
ConstructorsConstructorDescriptionCountry()Constructs an instance ofCountrywith no data.Constructs an instance ofCountry.Country(List<String> locales, Integer confidence, Long geonameId, boolean isInEuropeanUnion, String isoCode, Map<String, String> names) Compact canonical constructor that ensures immutability and handles null values. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theconfidencerecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegeonameIdrecord component.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.UsegeonameId()instead.Deprecated, for removal: This API element is subject to removal in a future version.UseisoCode()instead.getName()Deprecated, for removal: This API element is subject to removal in a future version.UseNamedRecord.name()instead.getNames()Deprecated, for removal: This API element is subject to removal in a future version.Usenames()instead.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisInEuropeanUnionrecord component.isoCode()Returns the value of theisoCoderecord component.locales()Returns the value of thelocalesrecord component.names()Returns the value of thenamesrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from interface JsonSerializable
toJsonMethods inherited from interface NamedRecord
name
-
Constructor Details
-
Country
-
Country
public Country()Constructs an instance ofCountrywith no data. -
Country
-
-
Method Details
-
getConfidence
Deprecated, for removal: This API element is subject to removal in a future version.Useconfidence()instead. This method will be removed in 6.0.0.- Returns:
- A value from 0-100 indicating MaxMind's confidence that the country is correct. This attribute is only available from the Insights web service and the GeoIP2 Enterprise database.
-
getIsoCode
Deprecated, for removal: This API element is subject to removal in a future version.UseisoCode()instead. This method will be removed in 6.0.0.- Returns:
- The two-character ISO 3166-1 alpha code for the country.
-
getGeoNameId
Deprecated, for removal: This API element is subject to removal in a future version.UsegeonameId()instead. This method will be removed in 6.0.0.- Returns:
- The GeoName ID for the country.
-
getName
Deprecated, for removal: This API element is subject to removal in a future version.UseNamedRecord.name()instead. This method will be removed in 6.0.0.- Returns:
- The name of the country based on the locales list.
-
getNames
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
locales
-
confidence
Returns the value of theconfidencerecord component.- Returns:
- the value of the
confidencerecord component
-
geonameId
Returns the value of thegeonameIdrecord component.- Specified by:
geonameIdin interfaceNamedRecord- Returns:
- the value of the
geonameIdrecord component
-
isInEuropeanUnion
public boolean isInEuropeanUnion()Returns the value of theisInEuropeanUnionrecord component.- Returns:
- the value of the
isInEuropeanUnionrecord component
-
isoCode
-
names
-
confidence()instead.