I have to give a JSON answer. I'm using jackson to convert the class to json. I have a basic class of java. I need to add some extra fields to the existing base class to give my answer json. I came with two ideas.
- To extend the main Java class.
- Have another class with the class object as a constructor.
Concerns about two methods are:
- I have a base layer that returns a Java database object. I need to call a method to return my extended class object. In the main layer, I need to create an instance of the extended class and return
- I can easily get a JSON answer with that, but for every object, a type of package will be created.
Please guide me to have a design template for this