Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.beanutils.locale.LocaleConvertUtils
public class LocaleConvertUtils
extends java.lang.Object
LocaleConvertUtilsBean
.
These static utility method use the default instance. More sophisticated can be provided
by using a LocaleConvertUtilsBean
instance.
Method Summary | |
static String |
|
static String |
|
static String |
|
static Object |
|
static Object |
|
static Object |
|
static Object |
|
static Object |
|
static Object |
|
protected static FastHashMap |
|
static void |
|
static void |
|
static void |
|
static boolean |
|
static Locale |
|
static LocaleConverter |
|
protected static FastHashMap |
|
static void |
|
static void |
|
static void |
|
public static String convert(Object value)
Convert the specified locale-sensitive value into a String. For more details seeLocaleConvertUtilsBean
- Parameters:
value
- The Value to be converted
- Returns:
- the converted value
public static String convert(Object value, Locale locale, String pattern)
Convert the specified locale-sensitive value into a String using the paticular convertion pattern. For more details seeLocaleConvertUtilsBean
- Parameters:
value
- The Value to be convertedlocale
- The localepattern
- The convertion pattern
- Returns:
- the converted value
public static String convert(Object value, String pattern)
Convert the specified locale-sensitive value into a String using the conversion pattern. For more details seeLocaleConvertUtilsBean
- Parameters:
value
- The Value to be convertedpattern
- The convertion pattern
- Returns:
- the converted value
public static Object convert(String value, Class clazz)
Convert the specified value to an object of the specified class (if possible). Otherwise, return a String representation of the value. For more details seeLocaleConvertUtilsBean
- Parameters:
value
- The String scalar value to be convertedclazz
- The Data type to which this value should be converted.
- Returns:
- the converted value
public static Object convert(String value, Class clazz, Locale locale, String pattern)
Convert the specified value to an object of the specified class (if possible) using the convertion pattern. Otherwise, return a String representation of the value. For more details seeLocaleConvertUtilsBean
- Parameters:
value
- The String scalar value to be convertedclazz
- The Data type to which this value should be converted.locale
- The localepattern
- The convertion pattern
- Returns:
- the converted value
public static Object convert(String value, Class clazz, String pattern)
Convert the specified value to an object of the specified class (if possible) using the convertion pattern. Otherwise, return a String representation of the value. For more details seeLocaleConvertUtilsBean
- Parameters:
value
- The String scalar value to be convertedclazz
- The Data type to which this value should be converted.pattern
- The convertion pattern
- Returns:
- the converted value
public static Object convert(String[] values, Class clazz)
Convert an array of specified values to an array of objects of the specified class (if possible). For more details seeLocaleConvertUtilsBean
- Parameters:
values
- Value to be converted (may be null)clazz
- Java array or element class to be converted to
- Returns:
- the converted value
public static Object convert(String[] values, Class clazz, Locale locale, String pattern)
Convert an array of specified values to an array of objects of the specified class (if possible) using the convertion pattern. For more details seeLocaleConvertUtilsBean
- Parameters:
values
- Value to be converted (may be null)clazz
- Java array or element class to be converted tolocale
- The localepattern
- The convertion pattern
- Returns:
- the converted value
public static Object convert(String[] values, Class clazz, String pattern)
Convert an array of specified values to an array of objects of the specified class (if possible) using the convertion pattern. For more details seeLocaleConvertUtilsBean
- Parameters:
values
- Value to be converted (may be null)clazz
- Java array or element class to be converted topattern
- The convertion pattern
- Returns:
- the converted value
protected static FastHashMap create(Locale locale)
Deprecated. This method will be modified to return a Map in the next release.
Create allLocaleConverter
types for specified locale. For more details seeLocaleConvertUtilsBean
- Parameters:
locale
- The Locale
- Returns:
- The FastHashMap instance contains the all
LocaleConverter
types for the specified locale.
public static void deregister()
Remove any registeredLocaleConverter
. For more details seeLocaleConvertUtilsBean
- See Also:
LocaleConvertUtilsBean.deregister()
public static void deregister(Class clazz, Locale locale)
Remove any registeredLocaleConverter
for the specified locale and Class. For more details seeLocaleConvertUtilsBean
- Parameters:
clazz
- Class for which to remove a registered Converterlocale
- The locale
public static void deregister(Locale locale)
Remove any registeredLocaleConverter
for the specified locale. For more details seeLocaleConvertUtilsBean
- Parameters:
locale
- The locale
public static boolean getApplyLocalized()
Gets applyLocalized. For more details seeLocaleConvertUtilsBean
- Returns:
true
if pattern is localized, otherwisefalse
public static Locale getDefaultLocale()
Gets theLocale
which will be used when noLocale
is passed to a method. For more details seeLocaleConvertUtilsBean
- Returns:
- the default locale
public static LocaleConverter lookup(Class clazz, Locale locale)
Look up and return any registeredLocaleConverter
for the specified destination class and locale; if there is no registered Converter, returnnull
. For more details seeLocaleConvertUtilsBean
- Parameters:
clazz
- Class for which to return a registered Converterlocale
- The Locale
- Returns:
- The registered locale Converter, if any
protected static FastHashMap lookup(Locale locale)
Deprecated. This method will be modified to return a Map in the next release.
Look up and return any registered FastHashMap instance for the specified locale. For more details seeLocaleConvertUtilsBean
- Parameters:
locale
- The Locale
- Returns:
- The FastHashMap instance contains the all
LocaleConverter
types for the specified locale.
public static void register(LocaleConverter converter, Class clazz, Locale locale)
Register a customLocaleConverter
for the specified destinationClass
, replacing any previously registered converter. For more details seeLocaleConvertUtilsBean
- Parameters:
converter
- The LocaleConverter to be registeredclazz
- The Destination class for conversions performed by this Converterlocale
- The locale
public static void setApplyLocalized(boolean newApplyLocalized)
Sets applyLocalized. For more details seeLocaleConvertUtilsBean
- Parameters:
newApplyLocalized
-true
if pattern is localized, otherwisefalse
public static void setDefaultLocale(Locale locale)
Sets theLocale
which will be used when noLocale
is passed to a method. For more details seeLocaleConvertUtilsBean
- Parameters:
locale
- the default locale