Class LoggingLocale


  • class LoggingLocale
    extends java.lang.Object
    A simple utility to resolve the default locale to use for internationalized loggers and message bundles.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Locale LOCALE  
    • Constructor Summary

      Constructors 
      Constructor Description
      LoggingLocale()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.util.Locale forLanguageTag​(java.lang.String locale)  
      private static java.util.Locale getDefaultLocale()  
      (package private) static java.util.Locale getLocale()
      Attempts to create a Locale based on the org.jboss.logging.locale system property.
      private static boolean isAlpha​(java.lang.String value, int minLen, int maxLen)  
      private static boolean isAlphaOrNumeric​(java.lang.String value, int minLen, int maxLen)  
      private static boolean isNumeric​(java.lang.String value, int minLen, int maxLen)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOCALE

        private static final java.util.Locale LOCALE
    • Constructor Detail

      • LoggingLocale

        LoggingLocale()
    • Method Detail

      • getLocale

        static java.util.Locale getLocale()
        Attempts to create a Locale based on the org.jboss.logging.locale system property. If the value is not defined the default locale will be used.

        The value should be in the BCP 47 format.

        Note: Currently this uses a custom parser to attempt to parse the BCP 47 format. This will be changed to use the Locale.forLanguageTag() once a move to JDK 7. Currently only the language, region and variant are used to construct the locale.

        Returns:
        the locale created or the default locale
      • getDefaultLocale

        private static java.util.Locale getDefaultLocale()
      • forLanguageTag

        private static java.util.Locale forLanguageTag​(java.lang.String locale)
      • isAlpha

        private static boolean isAlpha​(java.lang.String value,
                                       int minLen,
                                       int maxLen)
      • isNumeric

        private static boolean isNumeric​(java.lang.String value,
                                         int minLen,
                                         int maxLen)
      • isAlphaOrNumeric

        private static boolean isAlphaOrNumeric​(java.lang.String value,
                                                int minLen,
                                                int maxLen)