Class ModelHelper
- java.lang.Object
-
- de.xima.fc.api.rest.impl.common.models.ModelHelper
-
public class ModelHelper extends Object
Helper class for models.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getDefaultLocalization(ILocalizationProviding<?,?> localizationProvider, String i18nKey, Locale locale)
Get the localization for the given default i18n key.static String
getDefaultLocalization(ILocalizationProviding<?,?> localizationProvider, String i18nKey, Locale locale, String defaultI18nKey)
Get the localization for the given default i18n key.static String
getDefaultLocalization(ILocalizationProviding<?,?> localizationProvider, String i18nKey, Locale locale, Locale fallbackLocale, String defaultI18nKey)
Get the localization for the given default i18n key.static String
getDefaultLocalization(String i18nKey, Locale locale, Locale fallbackLocale)
Get the default localization for the given i18n key.
-
-
-
Method Detail
-
getDefaultLocalization
public static String getDefaultLocalization(ILocalizationProviding<?,?> localizationProvider, String i18nKey, Locale locale)
Get the localization for the given default i18n key. If a localization is not found in the given locale, the fallback locale is used. If the localization is not found in the fallback locale, the default localization given by the default i18n key is used.- Parameters:
localizationProvider
- the object providing the localizationi18nKey
- the i18n key to get the localization forlocale
- the locale to get the localization for- Returns:
- the localization
-
getDefaultLocalization
public static String getDefaultLocalization(ILocalizationProviding<?,?> localizationProvider, String i18nKey, Locale locale, String defaultI18nKey)
Get the localization for the given default i18n key. If a localization is not found in the given locale, the fallback locale is used. If the localization is not found in the fallback locale, the default localization given by the default i18n key is used.- Parameters:
localizationProvider
- the object providing the localizationi18nKey
- the i18n key to get the localization forlocale
- the locale to get the localization fordefaultI18nKey
- the default i18n key to use if the localization is not found in the given locale or the fallback locale- Returns:
- the localization
-
getDefaultLocalization
public static String getDefaultLocalization(ILocalizationProviding<?,?> localizationProvider, String i18nKey, Locale locale, Locale fallbackLocale, String defaultI18nKey)
Get the localization for the given default i18n key. If a localization is not found in the given locale, the fallback locale is used. If the localization is not found in the fallback locale, the default localization given by the default i18n key is used.- Parameters:
localizationProvider
- the object providing the localizationi18nKey
- the i18n key to get the localization forlocale
- the locale to get the localization forfallbackLocale
- the fallback locale to use if the localization is not found in the given localedefaultI18nKey
- the default i18n key to use if the localization is not found in the given locale or the fallback locale- Returns:
- the localization
-
getDefaultLocalization
public static String getDefaultLocalization(String i18nKey, Locale locale, Locale fallbackLocale)
Get the default localization for the given i18n key. If the localization is not found in the given locale, the fallback locale is used. If the localization is not found in the fallback locale, the English localization is used.- Parameters:
i18nKey
- the i18n keylocale
- the localefallbackLocale
- the fallback locale to use if the localization is not found in the given locale- Returns:
- the default localization
-
-