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