|
From: Jean M. <jea...@gm...> - 2013-06-05 04:49:37
|
Hi devs, Let's say we have a graph of many JPA entities that we would like to expose as REST resources. Since the graph is pretty big, we want to send only small subgraphs at time, allowing the user to navigate in the graph using links (HATEOAS). How would you implement this scenario? I have sketched a solution and I would really appreciate your comments on it. - Create a class annotation @Summarizable and a field annotation @Summary. - Modify the behavior of the marshaller to break the graph in subgraph where @Summarizable classes are found. - Except the root of the marshalled graph, when the marchaller encounters an object marked as Summarizable, it would marshall only its fields marked Summary and add a link to retrieve the full object. Is-it something doable? Do you have a better solution? Regards, Jean |