(CharSequence data)
| 349 | } |
| 350 | |
| 351 | private void handle(CharSequence data) { |
| 352 | // Parse the incoming message once, here, into a Map. A response then passes its "result" |
| 353 | // value to the command's mapper and an event passes its "params" Map to the event's mapper; |
| 354 | // neither re-parses the message text. |
| 355 | String asString = String.valueOf(data); |
| 356 | LOG.log(getDebugLogLevel(), "<- {0}", asString); |
| 357 | |
| 358 | Map<String, Object> raw = JSON.toType(asString, MAP_TYPE); |
| 359 | if (raw.get("id") instanceof Number |
| 360 | && (raw.get("result") != null || raw.get("error") != null)) { |
| 361 | handleResponse(raw); |
| 362 | } else if (raw.get("method") instanceof String && raw.get("params") instanceof Map) { |
| 363 | handleEventResponse(raw); |
| 364 | } else { |
| 365 | LOG.warning(() -> "Unhandled type BiDi response type: " + data); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | private void handleResponse(Map<String, Object> rawDataMap) { |
| 370 | Consumer<Either<Throwable, @Nullable Object>> consumer = |
nothing calls this directly
no test coverage detected