Class CurrentLocale


  • public final class CurrentLocale
    extends java.lang.Object
    Thread local variable that impacts localization of all messages in the connector framework. This is roughly equivalent to .Net's Thread.CurrentCulture.

    Note that this is an inheritable thread local so it is automatically inherited from parent to child thread. Of course, if the child thread is part of a thread pool, you will still need to manually propagate from parent to child.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clear()
      Clears the locale for the current thread.
      static java.util.Locale get()
      Gets the locale from the current thread.
      static boolean isSet()
      Returns true if a thread-local locale is specified on the current thread.
      static void set​(java.util.Locale locale)
      Sets the locale for the current thread.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • set

        public static void set​(java.util.Locale locale)
        Sets the locale for the current thread.
        Parameters:
        locale - The locale to use.
      • clear

        public static void clear()
        Clears the locale for the current thread.
      • get

        public static java.util.Locale get()
        Gets the locale from the current thread. Returns Locale.getDefault if no locale is specified.
        Returns:
        the locale from the current thread.
      • isSet

        public static boolean isSet()
        Returns true if a thread-local locale is specified on the current thread.
        Returns:
        true if a thread-local locale is specified on the current thread.