Class AddressUtils

java.lang.Object
de.bytestore.hostinger.handler.AddressUtils

public class AddressUtils extends Object
  • Constructor Details

    • AddressUtils

      public AddressUtils()
  • Method Details

    • loadGeoIP

      public static void loadGeoIP()
    • getCoordinates

      public static CompletableFuture<List<Double>> getCoordinates(String addressIO)
    • getAddress

      public static CompletableFuture<Collection<AddressResult>> getAddress(String addressIO)
    • format

      public static String format(AddressResult addressIO)
      Format Address Result to String.
      Parameters:
      addressIO -
      Returns:
    • getCountries

      public static List<Locale> getCountries()
      This method returns a list of Locale objects representing the countries.
      Returns:
      a List of Locale objects representing the countries.
    • queryLocation

      public static com.maxmind.geoip2.model.CityResponse queryLocation(String addressIO)
      This method queries the location information using the GeoIP service.
      Parameters:
      addressIO - the address of the location to query
      Returns:
      a CityResponse object containing the location information
      Throws:
      RuntimeException - if there is an error while querying the location
    • loadCountries

      public static void loadCountries()
      This method loads the list of Locale objects representing the countries and stores them in a static field. The list is obtained by calling the getISOCountries() method of the Locale class. Each country code is used to create a new Locale object, which is then added to the result list.
    • byISO3166_1_Alpha_2Country

      public static Locale byISO3166_1_Alpha_2Country(String countryCode)
      This method retrieves a Locale object representing a country based on the ISO country code.
      Parameters:
      countryCode - the ISO country code
      Returns:
      the Locale object representing the country, or null if not found