Class TypeConverter


  • public final class TypeConverter
    extends Object
    A utilities class used by generated clients to easily convert between nested types, such as lists and maps.
    • Method Detail

      • convert

        public static <T,​U> U convert​(T toConvert,
                                            Function<? super T,​? extends U> converter)
        Null-safely convert between types by applying a function.
      • convert

        public static <T,​U> List<U> convert​(List<T> toConvert,
                                                  Function<? super T,​? extends U> converter)
        Null-safely convert between two lists by applying a function to each value.
      • convert

        public static <T1,​T2,​U1,​U2> Map<U1,​U2> convert​(Map<T1,​T2> toConvert,
                                                                               Function<? super T1,​? extends U1> keyConverter,
                                                                               Function<? super T2,​? extends U2> valueConverter,
                                                                               BiPredicate<U1,​U2> resultFilter)
        Null-safely convert between two maps by applying a function to each key and value. A predicate is also specified to filter the results, in case the mapping function were to generate duplicate keys, etc.