Package org.jaxen.function.ext
Class LocaleFunctionSupport
- java.lang.Object
-
- org.jaxen.function.ext.LocaleFunctionSupport
-
- All Implemented Interfaces:
Function
- Direct Known Subclasses:
LowerFunction
,UpperFunction
public abstract class LocaleFunctionSupport extends java.lang.Object implements Function
An abstract base class for Locale-specific extension functions. This class provides convenience methods that can be inherited, specifically to find a Locale from an XPath function argument value.
- Author:
- James Strachan
-
-
Constructor Summary
Constructors Constructor Description LocaleFunctionSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Locale
findLocale(java.lang.String localeText)
Tries to find a Locale instance by name using RFC 3066 language tags such as 'en', 'en-US', 'en-US-Brooklyn'.protected java.util.Locale
findLocaleForLanguage(java.lang.String language)
Finds the locale with the given language name with no country or variant, such as Locale.ENGLISH or Locale.FRENCHprotected java.util.Locale
getLocale(java.lang.Object value, Navigator navigator)
Attempts to convert the given function argument value into a Locale either via casting, extracting it from a List or looking up the named Locale using reflection.
-
-
-
Method Detail
-
getLocale
protected java.util.Locale getLocale(java.lang.Object value, Navigator navigator)
Attempts to convert the given function argument value into a Locale either via casting, extracting it from a List or looking up the named Locale using reflection.- Parameters:
value
- is either a Locale, a List containing a Locale or a String containing the name of a Locale as defined by the Locale static members.- Returns:
- the Locale for the value or null if one could not be deduced
-
findLocale
protected java.util.Locale findLocale(java.lang.String localeText)
Tries to find a Locale instance by name using RFC 3066 language tags such as 'en', 'en-US', 'en-US-Brooklyn'.- Parameters:
localeText
- the RFC 3066 language tag- Returns:
- the locale for the given text or null if one could not be found
-
findLocaleForLanguage
protected java.util.Locale findLocaleForLanguage(java.lang.String language)
Finds the locale with the given language name with no country or variant, such as Locale.ENGLISH or Locale.FRENCH- Parameters:
language
- the language code to look for- Returns:
- the locale for the given language or null if one could not be found
-
-