I have a library of objects, whose source code is not editable so cant annotate them, is there another way to config Jackson Mapper like via XML.
Asked
Active
Viewed 2,226 times
7
-
It'd be good to elaborate on kinds of things you need annotations for, just to make sure answers can address specific needs. – StaxMan Sep 25 '11 at 17:59
-
I haven't found a way so far, but I would love the feature if it existed: I see no reason why objects created by Jackson should know anything about it. – Emil D Mar 21 '14 at 14:40
1 Answers
4
What do you want to configure? Often there isn't need to configure anything.
One way to use annotations without modifying value classes is to use "mix-in annotations" (see, for example this)

StaxMan
- 113,358
- 34
- 211
- 239
-
Is it possible with Spring config to introduce these mixins as i dont want any build time dependencies in domain model – Zafar ali Sep 23 '11 at 08:55
-
I have no idea, I don't use Spring, so perhaps ask it on Spring mailing list. Still I am curious as to what kind of things you want to configure? If you want to enable features, spring config can be used to enable features of ObjectMapper. – StaxMan Sep 24 '11 at 01:39
-
I want to be able to tell configure ignore annotations in one environment but include in another for example i want some properties included in web services but when requested from webpage i want to ignore some relations, Because i dont want to rebuild and redpoly for evey enviornment just want in externalize this configuration may in XML as i am doing with most other technologies i am useing like JPA, Validation, and others – Zafar ali Sep 26 '11 at 15:21
-
Ok. So no, there is no functionality for external definitions -- sounds like potential extension module someone might want to write, as doing so is possible. But so far no one has needed it badly enough I guess. :) – StaxMan Sep 26 '11 at 17:57