hazelcast / hazelcast/hazelcast-cpp-client

[TRACKING ISSUE] Remove read default value methods from the CompactReader

Open
#999 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
91
Forks
54
Avg merge
1d 12m
Merged PRs (30d)
5

Description

The tracking issue for the Java side PR.

See https://github.com/hazelcast/hazelcast/pull/21876 for details.

---

We have decided not to provide the methods to read a default value
in case of a missing field in the data. These methods were meant
to be used with the class evolution, but we decided that those methods
were not very useful, as it was impossible to distinguish a read
from the binary data from a read of default values.

Instead, this PR introduces a new API to the CompactReader to check
the existence of a field with its name and kind.

```java
boolean hasField(String fieldName, FieldKind fieldKind);
```

The users are now meant to use this method for fields that have changed
or have a potential to change in the future.

```java
String foo;
if (reader.hasField("foo", FieldKind.STRING)) {
foo = reader.readString("foo");
} else {
foo = "NA";
}
```

Also, changed the parameter name of the CompactReader and CompactWriter
in CompactSerializer to `reader` (from `in`) and `writer` (from `out`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.