Class ConverterFunctions

java.lang.Object
org.openqa.selenium.bidi.ConverterFunctions

@Beta public class ConverterFunctions extends Object
  • Method Details

    • map

      public static <X> Function<@Nullable Object, X> map(String keyName, Type typeOfX)
      Build a Command result mapper for the common case where the useful value is a single field of the response's result object.

      The returned function is applied to a command's result value, which Connection has already parsed into a Map<String, Object>. It reads keyName from that map and deserializes it to typeOfX via Json.convert(Object, Type), without re-parsing any JSON text. Both the result and the field are required: a missing result or a null/absent field is an error.

      Parameters:
      keyName - the field to read from the command's result object
      typeOfX - the type to deserialize that field to (class or TypeToken)