Interface NamedRecord

All Superinterfaces:
JsonSerializable
All Known Implementing Classes:
City, Continent, Country, RepresentedCountry, Subdivision

public interface NamedRecord extends JsonSerializable
Interface for record classes that have localized names and GeoName IDs. Provides a default implementation for the name() method that returns the name in the first available locale.
  • Method Details

    • geonameId

      Long geonameId()
      Returns:
      The GeoName ID for this location.
    • names

      Map<String,String> names()
      Returns:
      A Map from locale codes to the name in that locale.
    • locales

      List<String> locales()
      Returns:
      The list of locales to use for name lookups.
    • name

      default String name()
      Returns:
      The name based on the locales list. Returns the name in the first locale for which a name is available. If no name is available in any of the specified locales, returns null.