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

Add annotation-based method(s) for injecting properties during serialization #638

Closed
cowtowncoder opened this issue Nov 27, 2014 · 0 comments
Milestone

Comments

@cowtowncoder
Copy link
Member

(note: replaces #322)

A very common need that is not currently supported is the ability to insert additional properties in JSON (etc) output, without requiring physical POJO properties. This could include things like:

  1. Injecting Jackson attribute (2.4) values (from Add support for annotation-based integration with attributes (see #319) #322)
  2. Injecting custom BeanPropertyWriter instances (or perhaps a new sub-type), giving more control

Now; although there are some existing annotations that could work her (@JsonSerialize, specifically, from databidn package), it might make sense to add a new annotation or annotations.

Some things to consider:

  1. How to specify ordering of these attributes? While @JsonPropertyOrder needs to take these into account, it'd make sense to at least specify "default" placement before or after "regular" properties.
  2. For attributes, should name of attribute be 1-to-1 with property name to use? (fine as default, but if/how to allow override?)
  3. How to minimize amount of annotation decorations to use, without exploding number of annotations; esp. considering need to support (1) and ()
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

1 participant