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

@transient annotation seems to be ignored #109

Closed
crumbpicker opened this issue Nov 16, 2013 · 8 comments
Closed

@transient annotation seems to be ignored #109

crumbpicker opened this issue Nov 16, 2013 · 8 comments
Milestone

Comments

@crumbpicker
Copy link

The scala builtin @transient annotation seems to be ignored.
@JsonIgnore does the job but the standard @transient annotation should produce a similar result isn't it ?

@christophercurrie
Copy link
Member

This is a reasonable feature request, that hasn't been implemented because no one has asked for it before. This will probably be added as an optional feature, though, since I don't want to change the default for current users.

@cowtowncoder
Copy link
Member

One quick note: use of transient (even Java keyword one) is bit challenging at this point. See FasterXML/jackson-databind#296 for details.

While Java keyword is recognized and used, it is not used transitively; that is, it is not assumed that the whole property is to be ignored. This because pattern like:

transient int value;
public int getValue() { return value; }

is ambiguous regarding intent: it could be that field itself is not to be serialized using JDK serialization; or that the property is not to be exposed.

However: it would be possible to add a SerializationFeature to allow use of transient (and its equivalents, which should then include Scala annotation) to basically mean ignoral, as if @JsonIgnore was used.
If so, jackson-databind should probably add a method in AnnotationIntrospector to find aliases that mean 'transient'.

Alternative would be to just add functionality in Scala module for similar effect. But having more general mechanism could come in handy for other annotation sets that have concept of transiency (JPA, Hibernate?)

@christophercurrie
Copy link
Member

Sounds perfect. We'll sync up when I'm getting closer to being ready to implementation.

@crumbpicker
Copy link
Author

Even better ! You're awesome, guys !

@christophercurrie christophercurrie modified the milestones: 2.4, 2.6 Nov 26, 2014
@JohnTheBeloved
Copy link

Please, what is the status of this issue as I need this too....and urgently, Thanks

@christophercurrie
Copy link
Member

The underlying issue FasterXML/jackson-databind#296 has not yet been addressed. If you need it urgently I would recommend looking into creating a PR for the databind project.

@cowtowncoder
Copy link
Member

FWTW, FasterXML/jackson-databind#296 was implemented for Jackson 2.6 and is now available.

@nbauernfeind nbauernfeind modified the milestones: 2.8.0, 2.6 Apr 26, 2016
nbauernfeind added a commit to nbauernfeind/jackson-module-scala that referenced this issue Apr 26, 2016
nbauernfeind added a commit to nbauernfeind/jackson-module-scala that referenced this issue Apr 26, 2016
@nbauernfeind
Copy link
Member

It appears that no other changes were needed to the Scala module. I've added a regression test, but will otherwise close this issue.

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

5 participants