org.apache.wsrp4j.util
Class LocaleHelper

java.lang.Object
  extended byorg.apache.wsrp4j.util.LocaleHelper

public class LocaleHelper
extends java.lang.Object


Constructor Summary
LocaleHelper()
           
 
Method Summary
static java.lang.String getCountryCode(java.lang.String locale)
          Gets the country code from a locales string representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].
static java.lang.String getLanguageCode(java.lang.String locale)
          Gets the language code from a locales string representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].
static java.util.Locale getLocale(java.lang.String locale)
          Convinence method to create a Locale object from a locales string representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].
static java.util.Locale[] getLocales(java.lang.String[] locales)
          Convinence method to create a Locale object array from a locales string array representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].
static java.lang.String getWsrpLocale(java.util.Locale locale)
          The method takes a given Locale and returns a string representation which is conform to the WSRP standard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleHelper

public LocaleHelper()
Method Detail

getLanguageCode

public static java.lang.String getLanguageCode(java.lang.String locale)
Gets the language code from a locales string representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].

Parameters:
locale - The locale as String.
Returns:
The language code.

getCountryCode

public static java.lang.String getCountryCode(java.lang.String locale)
Gets the country code from a locales string representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].

Parameters:
locale - The locale as String.
Returns:
The country code.

getLocale

public static java.util.Locale getLocale(java.lang.String locale)
Convinence method to create a Locale object from a locales string representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].

Parameters:
locale - The locale as String.
Returns:
The corresponding Locale object.

getWsrpLocale

public static java.lang.String getWsrpLocale(java.util.Locale locale)
The method takes a given Locale and returns a string representation which is conform to the WSRP standard.

Parameters:
locale - The Locale to be formatted.
Returns:
A string representation of the given locale which is conform to the WSRP standard.

getLocales

public static java.util.Locale[] getLocales(java.lang.String[] locales)
Convinence method to create a Locale object array from a locales string array representation, assuming that the provided locale has a format like [2 char language code]"-"[2 char country code].

Parameters:
locales - The locale as String.
Returns:
The corresponding Locale object.