Skip to content

Instantly share code, notes, and snippets.

@arselzer
Created May 5, 2018 06:07
Show Gist options
  • Save arselzer/322eacb79d571c7bda4f105992296e77 to your computer and use it in GitHub Desktop.
Save arselzer/322eacb79d571c7bda4f105992296e77 to your computer and use it in GitHub Desktop.
package at.ac.tuwien.inso.sepm.ticketline.client.rest.implementation;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class RestResponsePage<T> extends PageImpl<T> {
@JsonCreator
public RestResponsePage(@JsonProperty("content") List<T> content,
@JsonProperty("number") int number,
@JsonProperty("size") int size,
@JsonProperty("totalElements") Long totalElements) {
super(content, PageRequest.of(number, size), totalElements);
}
@Override
@JsonIgnore
public Pageable getPageable() {
return super.getPageable();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment