Class ModelHelper


  • public class ModelHelper
    extends Object
    Helper class for models.
    Since:
    8.2.0
    Author:
    XIMA MEDIA GmbH
    • 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 localization
        i18nKey - the i18n key to get the localization for
        locale - 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 localization
        i18nKey - the i18n key to get the localization for
        locale - the locale to get the localization for
        defaultI18nKey - 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 localization
        i18nKey - the i18n key to get the localization for
        locale - the locale to get the localization for
        fallbackLocale - the fallback locale to use if the localization is not found in the given locale
        defaultI18nKey - 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 key
        locale - the locale
        fallbackLocale - the fallback locale to use if the localization is not found in the given locale
        Returns:
        the default localization