if (type == null) { deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { JavaType actual = _handleUnknownTypeId(ctxt, typeId); if (actual == null) { // what should this be taken to mean?
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids, and such type id has been found. * * @since 2.4 */ protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt, Object typeId) throws IOException { JsonDeserializer<Object> deser; if (typeId == null) { /* 04-May-2014, tatu: Should error be obligatory, or should there be another method * for "try to deserialize with native tpye id"? */ deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { return ctxt.reportInputMismatch(baseType(), "No (native) type id found when one was expected for polymorphic type handling"); } } else { String typeIdStr = (typeId instanceof String) ? (String) typeId : String.valueOf(typeId); deser = _findDeserializer(ctxt, typeIdStr); } return deser.deserialize(jp, ctxt); }
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids. Assumption from there is that only native * type ids are to be used. * * @since 2.3 */ @Deprecated protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserializeWithNativeTypeId(jp, ctxt, jp.getTypeId()); }
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids, and such type id has been found. * * @since 2.4 */ protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt, Object typeId) throws IOException { JsonDeserializer<Object> deser; if (typeId == null) { /* 04-May-2014, tatu: Should error be obligatory, or should there be another method * for "try to deserialize with native tpye id"? */ deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { throw ctxt.mappingException("No (native) type id found when one was expected for polymorphic type handling"); } } else { String typeIdStr = (typeId instanceof String) ? (String) typeId : String.valueOf(typeId); deser = _findDeserializer(ctxt, typeIdStr); } return deser.deserialize(jp, ctxt); }
throw ctxt.unknownTypeException(_baseType, typeId); deser = _findDefaultImplDeserializer(ctxt); } else {
@Override protected JavaType _handleUnknownTypeId(DeserializationContext ctxt, String typeId) throws IOException { // 29-Jan-2018, tatu: No idea why this was added in 2.x. /* if (ctxt.hasValueDeserializerFor(_baseType, null)) { return _baseType; } */ return super._handleUnknownTypeId(ctxt, typeId); } }
private Object _deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { String[] typeIds = ionParser(p).getTypeAnnotations(); //cannot return null String typeIdToUse = null; TypeIdResolver typeIdResolver = super.getTypeIdResolver(); if (typeIdResolver instanceof MultipleTypeIdResolver) { typeIdToUse = ((MultipleTypeIdResolver) typeIdResolver).selectId(typeIds); } else if (null != typeIdResolver) { // Possibly multiple ids, but we don't have a polymorphic resolver; pick the first one which resolves for (String typeId : typeIds) { JavaType type = typeIdResolver.typeFromId(ctxt, typeId); if (null != type) { typeIdToUse = typeId; } } } JsonDeserializer<?> deserializer; if (null == typeIdToUse) { deserializer = _findDefaultImplDeserializer(ctxt); } else { deserializer = super._findDeserializer(ctxt, typeIdToUse); } // 22-Mar-2017, tatu: Getting `null` presumably means that no type id nor // default impl found, but that this is ok (otherwise exception thrown) if (deserializer == null) { return null; } return deserializer.deserialize(p, ctxt); }
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids, and such type id has been found. * * @since 2.4 */ protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt, Object typeId) throws IOException { JsonDeserializer<Object> deser; if (typeId == null) { /* 04-May-2014, tatu: Should error be obligatory, or should there be another method * for "try to deserialize with native tpye id"? */ deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { throw ctxt.mappingException("No (native) type id found when one was expected for polymorphic type handling"); } } else { String typeIdStr = (typeId instanceof String) ? (String) typeId : String.valueOf(typeId); deser = _findDeserializer(ctxt, typeIdStr); } return deser.deserialize(jp, ctxt); }
throw ctxt.unknownTypeException(_baseType, typeId); deser = _findDefaultImplDeserializer(ctxt); } else {
if (type == null) { deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { deser = _handleUnknownTypeId(ctxt, typeId, _idResolver, _baseType);
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids, and such type id has been found. * * @since 2.4 */ protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt, Object typeId) throws IOException { JsonDeserializer<Object> deser; if (typeId == null) { /* 04-May-2014, tatu: Should error be obligatory, or should there be another method * for "try to deserialize with native tpye id"? */ deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { ctxt.reportMappingException("No (native) type id found when one was expected for polymorphic type handling"); return null; } } else { String typeIdStr = (typeId instanceof String) ? (String) typeId : String.valueOf(typeId); deser = _findDeserializer(ctxt, typeIdStr); } return deser.deserialize(jp, ctxt); }
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids, and such type id has been found. * * @since 2.4 */ protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt, Object typeId) throws IOException { JsonDeserializer<Object> deser; if (typeId == null) { /* 04-May-2014, tatu: Should error be obligatory, or should there be another method * for "try to deserialize with native tpye id"? */ deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { return ctxt.reportInputMismatch(baseType(), "No (native) type id found when one was expected for polymorphic type handling"); } } else { String typeIdStr = (typeId instanceof String) ? (String) typeId : String.valueOf(typeId); deser = _findDeserializer(ctxt, typeIdStr); } return deser.deserialize(jp, ctxt); }
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids. Assumption from there is that only native * type ids are to be used. * * @since 2.3 */ @Deprecated protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserializeWithNativeTypeId(jp, ctxt, jp.getTypeId()); }
if (type == null) { deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { deser = _handleUnknownTypeId(ctxt, typeId, _idResolver, _baseType);
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids. Assumption from there is that only native * type ids are to be used. * * @since 2.3 */ @Deprecated protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserializeWithNativeTypeId(jp, ctxt, jp.getTypeId()); }
if (type == null) { deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { JavaType actual = _handleUnknownTypeId(ctxt, typeId, _idResolver, _baseType); if (actual == null) { // what should this be taken to mean?
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids. Assumption from there is that only native * type ids are to be used. * * @since 2.3 */ @Deprecated protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserializeWithNativeTypeId(jp, ctxt, jp.getTypeId()); }
if (type == null) { deser = _findDefaultImplDeserializer(ctxt); if (deser == null) { JavaType actual = _handleUnknownTypeId(ctxt, typeId); if (actual == null) { // what should this be taken to mean?
/** * Helper method called when {@link JsonParser} indicates that it can use * so-called native type ids. Assumption from there is that only native * type ids are to be used. * * @since 2.3 */ @Deprecated protected Object _deserializeWithNativeTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException { return _deserializeWithNativeTypeId(jp, ctxt, jp.getTypeId()); }