forked from OpenAPITools/jackson-databind-nullable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsonNullableDeserializers.java
More file actions
23 lines (19 loc) · 1.08 KB
/
JsonNullableDeserializers.java
File metadata and controls
23 lines (19 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package org.openapitools.jackson.nullable;
import tools.jackson.databind.DeserializationConfig;
import tools.jackson.databind.ValueDeserializer;
import tools.jackson.databind.BeanDescription.Supplier;
import tools.jackson.databind.deser.Deserializers;
import tools.jackson.databind.jsontype.TypeDeserializer;
import tools.jackson.databind.type.ReferenceType;
public class JsonNullableDeserializers extends Deserializers.Base {
@Override
public ValueDeserializer<?> findReferenceDeserializer(ReferenceType refType,
DeserializationConfig config, Supplier beanDescRef,
TypeDeserializer contentTypeDeserializer, ValueDeserializer<?> contentDeserializer) {
return (refType.hasRawClass(JsonNullable.class)) ? new JsonNullableDeserializer(refType, null, contentTypeDeserializer,contentDeserializer) : null;
}
@Override
public boolean hasDeserializerFor(DeserializationConfig config, Class<?> valueType) {
return JsonNullable.class.equals(valueType);
}
}