com.opensymphony.xwork2

## Class DefaultLocaleProvider

- java.lang.Object
- - com.opensymphony.xwork2.DefaultLocaleProvider

- All Implemented Interfaces:
    LocaleProvider

      public class DefaultLocaleProvider
      extends Object
      implements LocaleProvider

  Default implementation of `LocaleProvider`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultLocaleProvider()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 Detail

    - #### DefaultLocaleProvider

          public DefaultLocaleProvider()

  - ### Method Detail

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

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.