JsonProperty Annotations not working properly for both marshalling/unmarshalling
--------------------------------------------------------------------------------
Key: SHINDIG-1134
URL: https://issues.apache.org/jira/browse/SHINDIG-1134
Project: Shindig
Issue Type: Bug
Components: Java
Affects Versions: 1.1-BETA1
Reporter: Paul Lindner
Assignee: Paul Lindner
Fix For: 1.1-BETA2
>From Cassie:
Hey everyone -
I have some legacy objects in my code base that I wanted to convert to and
from json with the BeanJsonConverter and JsonProperty. Problem is, it seems
that the same logic/annotation is being used to find getters and setters on
my pojos. So when I try to convert my pojo to a string, it ends up trying to
call setters, and not getters (or vice versa).
For example, I have a class Post.java with two fields "title" and "body".
Add setters and getters for these fields and things work dandy. However, I
need my json to use capital case: "Title" and "Body". To do this I figure I
need JsonProperty. So I go and add the JsonProperty("Title") and the other
annotation to the setters and who hoo I can take my json into a pojo with
capital case. But then - on the way from pojo to json the code grabs all
methods, and if they have a jsonProperty - it puts them in the getter map!
Unfortunately, this causes an IllegalArgException because of course my
setters take params, and the code is expecting them to be getters...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.