Package org.apache.struts2.locale

# 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 Summary

  Constructors
  Constructor
  Description
  `DefaultLocaleProvider()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Locale`
  `getLocale()`
  Gets the provided locale.
  `boolean`
  `isValidLocale(Locale locale)`
  Validates if provided `Locale` is value
  `boolean`
  `isValidLocaleString(String localeStr)`
  Validates if provided string is a valid `Locale`
  `Locale`
  `toLocale(String localeStr)`
  Tries to convert provided locale string into `Locale` or returns null

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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