Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppport simple deserialization of Cache #116

Merged
merged 6 commits into from May 4, 2023

Conversation

JooHyukKim
Copy link
Member

Supports deserialization side of Cache following #112.

Notes

  1. Implementation and class detection is can be kept miminal because Guava's Cache itself heavily relies on builder mechanism through CacheBuilder so it is most likely we cannot initialize by its subclasses.
  2. Here we referenced most from GuavaMultimapDeserializer Like how [Guava] Allow Cache serialization #112 Cache serialization was implemented.

return deserializeContents(p, ctxt);
}

private T deserializeContents(JsonParser p, DeserializationContext ctxt)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referenced most from

Comment on lines +137 to +150
p.nextToken();

final Object value;
if (p.currentToken() == JsonToken.VALUE_NULL) {
if (skipNullValues) {
continue;
}
value = nullProvider.getNullValue(ctxt);
} else if (elementTypeDeserializer != null) {
value = elementDeserializer.deserializeWithType(p, ctxt, elementTypeDeserializer);
} else {
value = elementDeserializer.deserialize(p, ctxt);
}
cache.put(key, value);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referenced most from...

Exception this part where we do not assume the value is array like


public void testGuavaCacheApi() throws Exception {
Cache<String, String> cache = CacheBuilder.newBuilder().build();
// Cache does not allow null key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with this, but in general it's not necessary to test dependencies of a library (they are assumed to work as specified).

@cowtowncoder cowtowncoder added this to the 2.16.0 milestone May 4, 2023
@cowtowncoder cowtowncoder merged commit a1bbc87 into FasterXML:2.16 May 4, 2023
3 checks passed
@cowtowncoder cowtowncoder changed the title [Guava] Suppport simple deserialization of Cache Suppport simple deserialization of Cache May 4, 2023
cowtowncoder added a commit that referenced this pull request May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants