I have a POJO named Person.java, is there any bash or utility that allows me to create a Backbone model named person.js from Person.java so I don’t have to re-type all the fields again?
Thank you.
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.
If you’re using the Jackson JSON Processor http://jackson.codehaus.org/ to translate your POJO model code to JSON, you should not have to recreate any of the properties on your Backbone model. A simple example:
You don’t even have to worry about doing this if you’re using a Spring MVC controller and mark your controller method with the following @RequestMapping annotation, like so:
Finally, your backbone model is as simple as:
You’re not required to specify any default attributes on your Backbone model, although it may be a good idea to do so.
Now when you fetch the model, you can access any of the properties that came from the original POJO on the Backbone model like this: