@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { return new XmlTextDeserializer(_verifyDeserType(_delegatee), _xmlTextPropertyIndex); }
@Override public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deser0) { if (!(deser0 instanceof BeanDeserializerBase)) { return deser0; } /* 17-Aug-2013, tatu: One important special case first: if we have one "XML Text" * property, it may be exposed as VALUE_STRING token (depending on whether any attribute * values are exposed): and to deserialize from that, we need special handling unless POJO * has appropriate single-string creator method. */ BeanDeserializerBase deser = (BeanDeserializerBase) deser0; // Heuristics are bit tricky; but for now let's assume that if POJO // can already work with VALUE_STRING, it's ok and doesn't need extra support if (!deser.getValueInstantiator().canCreateFromString()) { SettableBeanProperty textProp = _findSoleTextProp(config, deser.properties()); if (textProp != null) { return new XmlTextDeserializer(deser, textProp); } } return new WrapperHandlingDeserializer(deser); }
@Override public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deser0) { if (!(deser0 instanceof BeanDeserializerBase)) { return deser0; } /* 17-Aug-2013, tatu: One important special case first: if we have one "XML Text" * property, it may be exposed as VALUE_STRING token (depending on whether any attribute * values are exposed): and to deserialize from that, we need special handling unless POJO * has appropriate single-string creator method. */ BeanDeserializerBase deser = (BeanDeserializerBase) deser0; // Heuristics are bit tricky; but for now let's assume that if POJO // can already work with VALUE_STRING, it's ok and doesn't need extra support ValueInstantiator inst = deser.getValueInstantiator(); // 03-Aug-2017, tatu: [dataformat-xml#254] suggests we also should // allow passing `int`/`Integer`/`long`/`Long` cases, BUT // unfortunately we can not simple use default handling. Would need // coercion. if (!inst.canCreateFromString()) { SettableBeanProperty textProp = _findSoleTextProp(config, deser.properties()); if (textProp != null) { return new XmlTextDeserializer(deser, textProp); } } return new WrapperHandlingDeserializer(deser); }
@Override public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // 15-Nov-2017, tatu: Important -- MUST contextualize thing we delegate to JavaType vt = ctxt.constructType(_delegatee.handledType()); JsonDeserializer<?> del = ctxt.handleSecondaryContextualization(_delegatee, property, vt); return new XmlTextDeserializer(_verifyDeserType(del), _xmlTextPropertyIndex); }