/** * Allows the locales from a given set of locales. * @param localeIds the given set of locales. * @return this locale filter. */ public LocaleFilter include(Set<LocaleId> localeIds) { if (localeIds == null) return this; for (LocaleId localeId : localeIds) include(localeId); return this; }
/** * Allows the locales from a given list of locales. * @param localeIds the given list of locales. * @return this locale filter. */ public LocaleFilter include(List<LocaleId> localeIds) { if (localeIds == null) return this; for (LocaleId localeId : localeIds) include(localeId); return this; }
/** * Allows the locales from a given array of locales. * @param localeIds the given array of locales. * @return this locale filter. */ public LocaleFilter include(LocaleId ... localeIds) { if (Util.isEmpty(localeIds)) return this; for (LocaleId localeId : localeIds) include(localeId); return this; }
/** * Creates a filter allowing only the given locales. * @param localeIds an array of allowed LocaleId objects. * @return a newly created locale filter. */ public static LocaleFilter anyOf(LocaleId ... localeIds) { if (Util.isEmpty(localeIds)) return none(); LocaleFilter filter = none(); filter.include(localeIds); return filter; }
private void setLocale(boolean excludeMode, String language, String region) { if (Util.isEmpty(language)) return; if (Util.isEmpty(region)) return; if (excludeMode) exclude(new LocaleId(language, region)); else include(new LocaleId(language, region)); }
/** * Helper method. */ private void setLocale(boolean excludeMode, String language, String region, String userPart) { if (Util.isEmpty(language)) return; if (Util.isEmpty(region)) return; if (Util.isEmpty(userPart)) return; if (excludeMode) exclude(new LocaleId(language, region, userPart)); else include(new LocaleId(language, region, userPart)); }