Class ConvertUtil


  • public class ConvertUtil
    extends Object
    This class offers utility conversion methods.
    Since:
    4.0.4
    Version:
    $Revision: 24221 $ $Date: 2020-11-09 20:23:09 -0300 (Mon, 09 Nov 2020) $
    • Field Detail

      • DELEGATE_TO_REGISTERED_CONVERTER

        public static final IConverter DELEGATE_TO_REGISTERED_CONVERTER
        A converter that delegates calls to it to a registered converter.
        Since:
        4.0.4
        See Also:
        DelegateToRegisteredConverter
    • Constructor Detail

      • ConvertUtil

        public ConvertUtil()
    • Method Detail

      • register

        public static void register​(Class type,
                                    Class<? extends IConverter> converterClass)
      • deregister

        public static void deregister​(Class type)
      • convertAsList

        public 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.
        Parameters:
        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.
        Returns:
        the result list.
        Since:
        11.0.0