Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8201101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:41:29+00:00 2026-06-07T06:41:29+00:00

I have a POJO named Person.java, is there any bash or utility that allows

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:41:32+00:00Added an answer on June 7, 2026 at 6:41 am

    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:

    public String getPerson(){
        Person personPOJOInstance = new Person();
        ObjectMapper mapper = new ObjectMapper();
        StringWriter sw = new StringWriter();
    
        try{
            mapper.writeValue(sw, personPOJOInstance);
            pojoJSON = sw.getBuffer().toString();
        }
        catch(IOException exc){
    
        }
        return pojoJSON;
    }
    

    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:

    @RequestMapping(method= RequestMethod.GET, produces = "application/json", value="/path/to/controller/method")
    public @ResponseBody getPerson(){
        return new Person();
    }
    

    Finally, your backbone model is as simple as:

    var Person = Backbone.Model.extend({
        url: '/path/to/controller/method'
    });
    

    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:

    //instantiate and fetch your model.
    var person = new Person();
    person.fetch();
    ...
    //access properties on your model.
    var name = person.get('name');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a POJO that uses a service to do something: public class PlainOldJavaObject
We have a pojo that needs to have a list of integers. As an
I have a DSL Java object, i.e. a POJO which returns this in setters
I have a mapped POJO which I need to persist. In that POJO I
I have a POJO named sport with properties sportID, sportName, number of players. Using
Problem description: I have a POJO object, which is mapped from database. Which having
I have a need to create a report in DynamicJasper that has multiple subreports
I have a POJO that is used with GWT's RequestFactory and an associated proxy.
I have a class that looks like this: public class Person { public class
I have 2 POJO classes in Java, Answer and Collaborator, in a many-to-many relationship.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.