Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

Commit

Permalink
add deserializeNullable
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneider committed Oct 13, 2016
1 parent b5124ed commit c95921e
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -355,6 +355,17 @@ protected <T> T deserialize( @Nonnull Class<T> type, @Nonnull String propertyNam
return deserialize( type, formatVersion, deserializeFrom );
}

/**
* Supports null values
*/
@Nullable
public <T> T deserializeNullable(@Nonnull Class<T> type, @Nonnull Version formatVersion, @Nonnull JsonParser deserializeFrom) throws JsonProcessingException, IOException {
if (deserializeFrom.getCurrentToken() == JsonToken.VALUE_NULL) {
return null;
}
return super.deserialize(type, formatVersion, deserializeFrom);
}

@Nonnull
@Override
public <T> JacksonSerializer<? super T> getSerializer( @Nonnull Class<T> type ) {
Expand Down

0 comments on commit c95921e

Please sign in to comment.