*/
@Override
public Optional<?> deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer)
throws IOException, JsonProcessingException
{
final JsonToken t = jp.getCurrentToken();
if (t == JsonToken.VALUE_NULL) {
return getNullValue();
}
// 03-Nov-2013, tatu: This gets rather tricky with "natural" types
// (String, Integer, Boolean), which do NOT include type information.
// These might actually be handled ok except that nominal type here
// is `Optional`, so special handling is not invoked; instead, need
// to do a work-around here.
if (t != null && t.isScalarValue()) {
return deserialize(jp, ctxt);
}
// with type deserializer to use here? Looks like we get passed same one?
return Optional.of(typeDeserializer.deserializeTypedFromAny(jp, ctxt));
}