Class DefaultLocaleProvider

java.lang.Object
org.apache.struts2.locale.DefaultLocaleProvider
All Implemented Interfaces:
LocaleProvider

public class DefaultLocaleProvider extends Object implements LocaleProvider
Default implementation of LocaleProvider
  • Constructor Details

    • DefaultLocaleProvider

      public DefaultLocaleProvider()
  • Method Details

    • getLocale

      public Locale getLocale()
      Description copied from interface: LocaleProvider
      Gets the provided locale.
      Specified by:
      getLocale in interface LocaleProvider
      Returns:
      the locale.
    • isValidLocaleString

      public boolean isValidLocaleString(String localeStr)
      Description copied from interface: LocaleProvider
      Validates if provided string is a valid Locale
      Specified by:
      isValidLocaleString in interface LocaleProvider
      Parameters:
      localeStr - a String representing locale, e.g. en_EN
      Returns:
      true if valid
    • isValidLocale

      public boolean isValidLocale(Locale locale)
      Description copied from interface: LocaleProvider
      Validates if provided Locale is value
      Specified by:
      isValidLocale in interface LocaleProvider
      Parameters:
      locale - instance of Locale to validate
      Returns:
      true if valid
    • toLocale

      public Locale toLocale(String localeStr)
      Description copied from interface: LocaleProvider
      Tries to convert provided locale string into Locale or returns null
      Specified by:
      toLocale in interface LocaleProvider
      Parameters:
      localeStr - a String representing locale, e.g.: en_EN
      Returns:
      instance of Locale or null