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

@JsonAnyGetter can't be used on fields, even though documentation says it can be and @JsonAnySetter can #107

Closed
Raniz85 opened this issue Nov 18, 2016 · 2 comments
Milestone

Comments

@Raniz85
Copy link

Raniz85 commented Nov 18, 2016

The documentation for JsonAnyGetter states that it can be used on fields (emphasis mine):

Marker annotation that can be used to define a non-static, no-argument method or member field as something of a reverse of JsonAnySetter method

But the code only includes ANNOTATION_TYPE and METHOD.

@JsonAnySetter however also includes FIELD (but doesn't mention that this is valid in the documentation).

@cowtowncoder
Copy link
Member

Agreed: should improve handling (and javadocs for @JsonAnySetter -- this was implemented via #1047 for 2.8 and javadocs were not improved).
I created

FasterXML/jackson-databind#1458

since there's some work on databind to make this possible, not just annotations (since access from fields differs from methods).

Thank you for reporting this; hoping to implement for 2.9!

cowtowncoder added a commit that referenced this issue Nov 22, 2016
@cowtowncoder cowtowncoder added this to the 2.9.0 milestone Nov 22, 2016
@cowtowncoder
Copy link
Member

cowtowncoder commented Nov 22, 2016

Javadocs updated to reflect actual implementation. Also note somewhat related issue #109 which allows disabling of effects of both annotations (usually using mix-in annotations).

Note that for possible additional support for field-as-any-getter, there is now this:

FasterXML/jackson-databind#1458

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants