Record Class Continent

java.lang.Object
java.lang.Record
com.maxmind.geoip2.record.Continent
Record Components:
locales - The locales to use for retrieving localized names.
code - A two character continent code like "NA" (North America) or "OC" (Oceania).
geonameId - The GeoName ID for the continent.
names - A Map from locale codes to the name in that locale.
All Implemented Interfaces:
JsonSerializable, NamedRecord

public record Continent(List<String> locales, String code, Long geonameId, Map<String,String> names) extends Record implements NamedRecord

Contains data for the continent record associated with an IP address.

Do not use any of the continent names as a database or map key. Use the value returned by geonameId() or code() instead.

  • Constructor Details

    • Continent

      public Continent(List<String> locales, String code, Long geonameId, Map<String,String> names)
      Compact canonical constructor that ensures immutability and handles null values.
    • Continent

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

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

    • getCode

      @Deprecated(since="5.0.0", forRemoval=true) public String getCode()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use code() instead. This method will be removed in 6.0.0.
      Returns:
      A two character continent code like "NA" (North America) or "OC" (Oceania).
    • 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 continent.
    • 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 continent 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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • code

      public String code()
      Returns the value of the code record component.
      Returns:
      the value of the code 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
    • 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