Class TypeConverter

java.lang.Object
software.amazon.awssdk.core.runtime.TypeConverter

@SdkProtectedApi 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 Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    static <T, U> U
    convert(T toConvert, Function<? super T,? extends U> converter)
    Null-safely convert between types by applying a function.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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.