Record Class RepresentedCountry
java.lang.Object
java.lang.Record
com.maxmind.geoip2.record.RepresentedCountry
- 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.type- A string indicating the type of entity that is representing the country. Currently, we only returnmilitarybut this could expand to include other types in the future.
- All Implemented Interfaces:
JsonSerializable, NamedRecord
public record RepresentedCountry(List<String> locales, Integer confidence, Long geonameId, boolean isInEuropeanUnion, String isoCode, Map<String,String> names, String type)
extends Record
implements NamedRecord
Contains data for the represented country associated with an IP address.
This class contains the country-level data associated with an IP address for the IP's represented country. The represented country is the country represented by something like a military base.
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
ConstructorsConstructorDescriptionConstructs an instance ofRepresentedCountrywith no data.RepresentedCountry(RepresentedCountry country, List<String> locales) Constructs an instance ofRepresentedCountry.RepresentedCountry(List<String> locales, Integer confidence, Long geonameId, boolean isInEuropeanUnion, String isoCode, Map<String, String> names, String type) 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.getType()Deprecated, for removal: This API element is subject to removal in a future version.Usetype()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.type()Returns the value of thetyperecord component.Methods inherited from interface JsonSerializable
toJsonMethods inherited from interface NamedRecord
name
-
Constructor Details
-
RepresentedCountry
-
RepresentedCountry
public RepresentedCountry()Constructs an instance ofRepresentedCountrywith no data. -
RepresentedCountry
Constructs an instance ofRepresentedCountry.- Parameters:
country- TheRepresentedCountryobject to copy.locales- The locales to use.
-
-
Method Details
-
getType
Deprecated, for removal: This API element is subject to removal in a future version.Usetype()instead. This method will be removed in 6.0.0.- Returns:
- A string indicating the type of entity that is representing the
country. Currently, we only return
militarybut this could expand to include other types in the future.
-
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
-
type
-
confidence()instead.