@@ -234,6 +234,9 @@ public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type,
234
234
TypeDeserializer elementTypeDeserializer , JsonDeserializer <?> elementDeserializer )
235
235
throws JsonMappingException ;
236
236
237
+ // To be added in 3.0
238
+ // public boolean hasDeserializerFor(Class<?> valueType);
239
+
237
240
/*
238
241
/**********************************************************
239
242
/* Helper classes
@@ -247,7 +250,8 @@ public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type,
247
250
* of methods are not needed (especially enumeration and array deserializers are
248
251
* very rarely overridden).
249
252
*/
250
- public static class Base implements Deserializers
253
+ public abstract static class Base
254
+ implements Deserializers
251
255
{
252
256
@ Override
253
257
public JsonDeserializer <?> findEnumDeserializer (Class <?> type ,
@@ -265,14 +269,13 @@ public JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNode> no
265
269
return null ;
266
270
}
267
271
268
- @ Override // since 2.7
272
+ @ Override
269
273
public JsonDeserializer <?> findReferenceDeserializer (ReferenceType refType ,
270
274
DeserializationConfig config , BeanDescription beanDesc ,
271
275
TypeDeserializer contentTypeDeserializer , JsonDeserializer <?> contentDeserializer )
272
- throws JsonMappingException {
273
- // 21-Oct-2015, tatu: For backwards compatibility, let's delegate to "bean" variant,
274
- // for 2.7 -- remove work-around from 2.8 or later
275
- return findBeanDeserializer (refType , config , beanDesc );
276
+ throws JsonMappingException
277
+ {
278
+ return null ;
276
279
}
277
280
278
281
@ Override
@@ -329,5 +332,24 @@ public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type,
329
332
{
330
333
return null ;
331
334
}
335
+
336
+ /**
337
+ * Method that may be called to check whether this deserializer provider would provide
338
+ * deserializer for values of given type, without attempting to construct (and possibly
339
+ * fail in some cases) actual deserializer. Mostly needed to support validation
340
+ * of polymorphic type ids.
341
+ *<p>
342
+ * Note: implementations should take care NOT to claim supporting types that they do
343
+ * not recognize as this could to incorrect assumption of safe support by caller.
344
+ *<p>
345
+ * Method added in this implementation since adding new methods for interfaces
346
+ * before Java 8 is not a good idea: will be added in Jackson 3.0 for `Deserializers`.
347
+ *
348
+ * @since 2.11
349
+ */
350
+ public boolean hasDeserializerFor (Class <?> valueType ) {
351
+ return false ;
352
+ }
353
+ // public abstract boolean hasDeserializerFor(Class<?> valueType);
332
354
}
333
355
}
0 commit comments