Package io.rocketbase.commons.util
Class LocaleFilter
- java.lang.Object
-
- io.rocketbase.commons.util.LocaleFilter
-
public abstract class LocaleFilter extends Object
-
-
Constructor Summary
Constructors Constructor Description LocaleFilter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Map.Entry<Locale,T>findClosest(Locale filter, Map<Locale,T> values)static <T> Map.Entry<Locale,T>findClosest(Locale filter, Map<Locale,T> values, Locale fallback)search within values for given locale and follows some rules to try to get the best fitting valuestatic <T> Optional<Map.Entry<Locale,T>>findClosestOptional(Locale filter, Map<Locale,T> values)static <T> Optional<Map.Entry<Locale,T>>findClosestOptional(Locale filter, Map<Locale,T> values, Locale fallback)protected static Optional<Map.Entry<Locale,Locale>>transformMapFilterByLanguage(Map<Locale,?> values, Locale language)
-
-
-
Method Detail
-
findClosestOptional
public static <T> Optional<Map.Entry<Locale,T>> findClosestOptional(Locale filter, Map<Locale,T> values)
-
findClosest
public static <T> Map.Entry<Locale,T> findClosest(Locale filter, Map<Locale,T> values)
-
findClosestOptional
public static <T> Optional<Map.Entry<Locale,T>> findClosestOptional(Locale filter, Map<Locale,T> values, Locale fallback)
-
findClosest
public static <T> Map.Entry<Locale,T> findClosest(Locale filter, Map<Locale,T> values, Locale fallback)
search within values for given locale and follows some rules to try to get the best fitting value- Parameters:
filter- locale you are searching for
when containing also country information - searches when no exact match found only by languagevalues- map of Locale valuesfallback- in case nothing found (filter as it is / just language) try to search again via fallback- Returns:
- entry with picked locale (in case it has been internally changed) and value of map
-
-