@Test public void deserializeIsLong() throws IOException { Long value = 9000L; when(node.isLong()).thenReturn(Boolean.TRUE); when(node.asLong()).thenReturn(value); assertEquals(value, deserializer.deserialize(jp, ct).getValue()); }
@Override public SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx) throws IOException { ObjectNode tree = jp.readValueAsTree(); Object value = null; if (tree.has("value")) { JsonNode node = tree.get("value"); if (node.isBoolean()) { value = node.asBoolean(); } else if (node.isDouble()) { value = node.asDouble(); } else if (node.isLong()) { value = node.asLong(); } else if (node.isInt()) { value = node.asInt(); } else { value = node.asText(); } if (value instanceof String) { String base64 = (String) value; try { value = Base64.getDecoder().decode(base64); } catch (RuntimeException e) { value = base64; } } } return new SyncToken(Objects.requireNonNull(value)); }
SyncTokenDeserializer extends JsonDeserializer<SyncToken> { @Override public SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx) throws IOException { ObjectNode tree = jp.readValueAsTree(); Object value = null; if (tree.has("value")) { JsonNode node = tree.get("value"); if (node.isBoolean()) { value = node.asBoolean(); } else if (node.isDouble()) { value = node.asDouble(); } else if (node.isLong()) { value = node.asLong(); } else if (node.isInt()) { value = node.asInt(); } else { value = node.asText(); } if (value instanceof String) { String base64 = (String) value; try { value = Base64.getDecoder().decode(base64); } catch (RuntimeException e) { value = base64; } } } return new SyncToken(Objects.requireNonNull(value)); } }
SyncTokenDeserializer extends JsonDeserializer<SyncToken> { @Override public SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx) throws IOException { ObjectNode tree = jp.readValueAsTree(); Object value = null; if (tree.has("value")) { JsonNode node = tree.get("value"); if (node.isBoolean()) { value = node.asBoolean(); } else if (node.isDouble()) { value = node.asDouble(); } else if (node.isLong()) { value = node.asLong(); } else if (node.isInt()) { value = node.asInt(); } else { value = node.asText(); } if (value instanceof String) { String base64 = (String) value; try { value = Base64.getDecoder().decode(base64); } catch (RuntimeException e) { value = base64; } } } return new SyncToken(Objects.requireNonNull(value)); }  }
SyncTokenDeserializer extends JsonDeserializer<SyncToken> { @Override public SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx) throws IOException { ObjectNode tree = jp.readValueAsTree(); Object value = null; if (tree.has("value")) { JsonNode node = tree.get("value"); if (node.isBoolean()) { value = node.asBoolean(); } else if (node.isDouble()) { value = node.asDouble(); } else if (node.isLong()) { value = node.asLong(); } else if (node.isInt()) { value = node.asInt(); } else { value = node.asText(); } if (value instanceof String) { String base64 = (String) value; try { value = Base64.getDecoder().decode(base64); } catch (RuntimeException e) { value = base64; } } } return new SyncToken(Objects.requireNonNull(value)); }  @Override SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx); }
SyncTokenDeserializer extends JsonDeserializer<SyncToken> { @Override public SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx) throws IOException { ObjectNode tree = jp.readValueAsTree(); Object value = null; if (tree.has("value")) { JsonNode node = tree.get("value"); if (node.isBoolean()) { value = node.asBoolean(); } else if (node.isDouble()) { value = node.asDouble(); } else if (node.isLong()) { value = node.asLong(); } else if (node.isInt()) { value = node.asInt(); } else { value = node.asText(); } if (value instanceof String) { String base64 = (String) value; try { value = Base64.getDecoder().decode(base64); } catch (RuntimeException e) { value = base64; } } } return new SyncToken(Objects.requireNonNull(value)); }  @Override SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx);  }