Skip to content

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

@hz-devops-test

Description

@hz-devops-test

The tracking issue for the Java side PR.

See hazelcast/hazelcast#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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions