Package de.bytestore.hostinger.handler
Class AddressUtils
java.lang.Object
de.bytestore.hostinger.handler.AddressUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalebyISO3166_1_Alpha_2Country(String countryCode) This method retrieves a Locale object representing a country based on the ISO country code.static Stringformat(AddressResult addressIO) Format Address Result to String.static CompletableFuture<Collection<AddressResult>>getAddress(String addressIO) static CompletableFuture<List<Double>>getCoordinates(String addressIO) This method returns a list of Locale objects representing the countries.static voidThis method loads the list of Locale objects representing the countries and stores them in a static field.static voidstatic com.maxmind.geoip2.model.CityResponsequeryLocation(String addressIO) This method queries the location information using the GeoIP service.
-
Constructor Details
-
AddressUtils
public AddressUtils()
-
-
Method Details
-
loadGeoIP
public static void loadGeoIP() -
getCoordinates
-
getAddress
-
format
Format Address Result to String.- Parameters:
addressIO-- Returns:
-
getCountries
This method returns a list of Locale objects representing the countries.- Returns:
- a List of Locale objects representing the countries.
-
queryLocation
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
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
-