public class ConvertUtil extends Object
Modifier and Type | Field and Description |
---|---|
static IConverter |
DELEGATE_TO_REGISTERED_CONVERTER
A converter that delegates calls to it to a registered converter.
|
Constructor and Description |
---|
ConvertUtil() |
Modifier and Type | Method and Description |
---|---|
static <T,R extends Collection<T>> |
convert(Class<T> valueType,
Iterable input,
R output,
Locale locale,
String pattern) |
static <T> T |
convert(Class<T> type,
Object value,
Locale locale,
String pattern) |
static <T> List<T> |
convertAsList(Class<T> valueType,
Object value,
Locale locale,
String pattern)
Converts the given value as a list.
If the given value is Iterable , then its inner elements will be converted to <T>, using convert(Class, Object, Locale, String) , and then
they will be added in a result List .If the given value is not Iterable , then it will be converted and then it will be added to a result List .The result list is Serializable and modifiable. |
static IConverter |
createConverter(Class type)
Create the appropriated converter for the given type.
|
static void |
deregister(Class type) |
static void |
register(Class type,
Class<? extends IConverter> converterClass) |
public static final IConverter DELEGATE_TO_REGISTERED_CONVERTER
DelegateToRegisteredConverter
public static void register(Class type, Class<? extends IConverter> converterClass)
public static void deregister(Class type)
public static IConverter createConverter(Class type) throws UnsupportedConversionTypeException
type
- the type that needs to be converted.UnsupportedConversionTypeException
- if the conversion is not supported.public static <T,R extends Collection<T>> Collection<T> convert(Class<T> valueType, Iterable input, R output, Locale locale, String pattern)
public static <T> List<T> convertAsList(Class<T> valueType, Object value, Locale locale, String pattern)
Iterable
, then its inner elements will be converted to <T>, using convert(Class, Object, Locale, String)
, and then
they will be added in a result List
.Iterable
, then it will be converted and then it will be added to a result List
.Serializable
and modifiable.valueType
- the value type class.value
- the value itself, either a raw value or an iterable of raw values.locale
- the locale.pattern
- the pattern.LumisXP 12.3.0.200408 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.