Skip to content

Rename ambiguous JsonProperty.Access.* constants #233

@overheadhunter

Description

@overheadhunter

I'd like to request a rather trivial change, however it is API-breaking, so I fully understand this can only be done for the next major version:

Today, I got confused by @JsonProperty(value = "...", access = JsonProperty.Access.WRITE_ONLY). I'm in a context, where I read from and write to a json file. So "write" means "serialize" and "read" means "deserialize" in my context.

However, the above constants WRITE_ONLY and READ_ONLY are named from the object mapper's perspective writing values to the java object ("setting") or reading values from java objects ("getting").

In other words: The constant names are highly dependent from the perspective, to say the least. Therefore I'm suggesting to rename them as follows:

old new
AUTO AUTO
READ_ONLY SERIALIZE_ONLY
WRITE_ONLY DESERIALIZE_ONLY
READ_WRITE ANY

(Jackson 2.15.2)

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