I have just implemented some read only fields on an api using MixIn to 
enforce the rename and also the ignore on deserialisation. Like this

@JsonProperty(access = JsonProperty.Access.READ_ONLY, value = 
"_privateProperty")

The reason that I chose a MixIn was that the POJO is imported from a a 
different project (a standard model across multiple applications), and this 
appeared to be the most simple way of changing the 
serialisation/deserialisation. 
Since I have an abstract class containing a definition of a number of 
fields, annotated with this read_only property and a rename, but no other 
code I have come to see it somewhat as configuration code.

I have a question about testing my configuration though, if I make a typo 
in the MixIn definition, and so call my property 
_pirvateProperty

for example, this will obviously not affect the serialisation of my object 
with a correctly named field. Is there any way that I can make my 
application fail to start because of my defining a JsonProperty override 
for a field that does not exist on the POJO?


Thanks,
Stephen

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to