[TRACKING ISSUE] Remove read default value methods from the CompactReader
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.
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.
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).