(CharSequence data)
| 297 | } |
| 298 | |
| 299 | private void handle(CharSequence data) { |
| 300 | // It's kind of gross to decode the data twice, but this lets us get started on something |
| 301 | // that feels nice to users. |
| 302 | // TODO: decode once, and once only |
| 303 | |
| 304 | String asString = String.valueOf(data); |
| 305 | LOG.log(getDebugLogLevel(), "<- {0}", asString); |
| 306 | |
| 307 | Map<String, Object> raw = JSON.toType(asString, MAP_TYPE); |
| 308 | if (raw.get("id") instanceof Number |
| 309 | && (raw.get("result") != null || raw.get("error") != null)) { |
| 310 | handleResponse(asString, raw); |
| 311 | } else if (raw.get("method") instanceof String && raw.get("params") instanceof Map) { |
| 312 | handleEventResponse(raw); |
| 313 | } else { |
| 314 | LOG.warning(() -> "Unhandled type BiDi response type: " + data); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | private void handleResponse(String rawDataString, Map<String, Object> rawDataMap) { |
| 319 | Consumer<Either<Throwable, JsonInput>> consumer = |
nothing calls this directly
no test coverage detected