As question mention, I am very curious, why when the deserialization happen, it does not need setter for the fields? Only getter is needed?
I am using Jackson’s JSON.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Jackson, and similar Java-to/from-JSON tools, don’t even need a getter to set/modify a field value. The field to be set/modified could even be private and final (with a value already specified — Jackson won’t necessarily respect the immutability of a field). How is this possible? As Thomas suggested, Jackson can use reflection to set field values. This behavior is described at http://www.cowtowncoder.com/blog/archives/2010/08/entry_409.html.