Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<A> daoMethod() {
- List<Object[]> dbResult = getDbResults();
- List<A> javaObjects = new ArrayList<>();
- // build nested Java objects
- for (Object[] line in dbResult) {
- A a = new A();
- a.setProp1(line[0]);
- a.setProp2(line[1]);
- // and so on...
- javaObjects.add(a);
- return javaObjects ;
- }
- }
- public ResponseEntity<A> controllerMethod() {
- List<A> javaObjects = myDao.daoMethod();
- return new ResponseEntity(javaObjects, HttpStatus.OK);
- }
- @JsonInclude(JsonInclude.Include.NON_NULL) // removes all fields having NULL value
- public abstract class BaseDto implements Serializable{
- // some properties...
- }
- {
- prop1: "some string",
- prop2: [{},{},{}],
- prop3: [],
- prop4: {},
- }
- {
- prop1: "some string"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement