Class LocationUtils


  • public class LocationUtils
    extends Object
    Mapping between Country codes, English Country names, Continent Codes, and English Continent names
    Author:
    kevinvandevelde at atmire.com, ben at atmire.com
    • Method Detail

      • getContinentCode

        public static String getContinentCode​(String countryCode)
        Map DSpace continent codes onto ISO country codes.
        Parameters:
        countryCode - ISO 3166-1 alpha-2 country code.
        Returns:
        DSpace 2-character code for continent containing that country, or an error message string.
      • getContinentName

        public static String getContinentName​(String continentCode,
                                              Locale locale)
        Map DSpace continent codes onto localized continent names.
        Parameters:
        continentCode - DSpace 2-character code for a continent.
        locale - The desired localization.
        Returns:
        Localized name of the continent, or an error message string.
      • getCountryCode

        public static String getCountryCode​(String countryName)
        Revert a country name back into a country code (iso2) Source: https://stackoverflow.com/a/38588988
        Parameters:
        countryName - Name of country (according to Locale)
        Returns:
        Corresponding iso2 country code
      • getCountryName

        public static String getCountryName​(String countryCode,
                                            Locale locale)
        Map ISO country codes onto localized country names.
        Parameters:
        countryCode - ISO 3166-1 alpha-2 country code.
        locale - Desired localization.
        Returns:
        Localized name of the country, or an error message string.