In this recipe, we'll create a wrapper class to represent collections of resources with pagination information. We'll also use the JsonRootName annotation from the jackson library to make single-resource representations consistent. The following code should be added to the message service, which was introduced in a previous recipe:
- Create a new class called ResourceCollection. This class will be a regular POJO with fields to represent the page number, a list of items, and a URL that can be used to access the next page in a collection:
package com.packtpub.microservices.ch04.message.models;import com.fasterxml.jackson.annotation.JsonProperty;import com.fasterxml.jackson.annotation.JsonRootName;import java.util.List;@JsonRootName("result") ...