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 - A Map from locale codes to the name in that locale.
type - A string indicating the type of entity that is representing the country. Currently, we only return military but 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 Details

    • RepresentedCountry

      public 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.
    • RepresentedCountry

      public RepresentedCountry()
      Constructs an instance of RepresentedCountry with no data.
    • RepresentedCountry

      public RepresentedCountry(RepresentedCountry country, List<String> locales)
      Constructs an instance of RepresentedCountry.
      Parameters:
      country - The RepresentedCountry object to copy.
      locales - The locales to use.
  • Method Details

    • getType

      @Deprecated(since="5.0.0", forRemoval=true) public String getType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use type() 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 military but this could expand to include other types in the future.
    • getConfidence

      @Deprecated(since="5.0.0", forRemoval=true) public Integer getConfidence()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use confidence() 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(since="5.0.0", forRemoval=true) public String getIsoCode()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use isoCode() instead. This method will be removed in 6.0.0.
      Returns:
      The two-character ISO 3166-1 alpha code for the country.
    • getGeoNameId

      @Deprecated(since="5.0.0", forRemoval=true) public Long getGeoNameId()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use geonameId() instead. This method will be removed in 6.0.0.
      Returns:
      The GeoName ID for the country.
    • getName

      @Deprecated(since="5.0.0", forRemoval=true) public String getName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use NamedRecord.name() instead. This method will be removed in 6.0.0.
      Returns:
      The name of the country based on the locales list.
    • getNames

      @Deprecated(since="5.0.0", forRemoval=true) public Map<String,String> getNames()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use names() instead. This method will be removed in 6.0.0.
      Returns:
      A Map from locale codes to the name in that locale.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • locales

      public List<String> locales()
      Returns the value of the locales record component.
      Specified by:
      locales in interface NamedRecord
      Returns:
      the value of the locales record component
    • confidence

      public Integer confidence()
      Returns the value of the confidence record component.
      Returns:
      the value of the confidence record component
    • geonameId

      public Long geonameId()
      Returns the value of the geonameId record component.
      Specified by:
      geonameId in interface NamedRecord
      Returns:
      the value of the geonameId record component
    • isInEuropeanUnion

      public boolean isInEuropeanUnion()
      Returns the value of the isInEuropeanUnion record component.
      Returns:
      the value of the isInEuropeanUnion record component
    • isoCode

      public String isoCode()
      Returns the value of the isoCode record component.
      Returns:
      the value of the isoCode record component
    • names

      public Map<String,String> names()
      Returns the value of the names record component.
      Specified by:
      names in interface NamedRecord
      Returns:
      the value of the names record component
    • type

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