I need help in explaning this code and how the PagingandSorting repository works. Springboot ======================================================================================= public class PageResponse { intpageNum; intpageSize; inttotalPages; Listcontent; publicPageResponse(Pagepaged){ if(Optional.ofNullable(paged).isPresent()){ this.pageNum=paged.getNumber(); this.pageSize=paged.getSize(); this.totalPages=paged.getTotalPages(); this.content=paged.getContent(); } } publicintgetPageNum(){ returnpageNum; } publicvoidsetPageNum(intpageNum){ this.pageNum=pageNum; } publicintgetPageSize(){ returnpageSize; } publicvoidsetPageSize(intpageSize){ this.pageSize=pageSize; } publicintgetTotalPages(){ returntotalPages; } publicvoidsetTotalPages(inttotalPages){ this.totalPages=totalPages; } publicListgetContent(){ returncontent; } publicvoidsetContent(Listcontent){ this.content=content; } }
I need help in explaning this code and how the PagingandSorting repository works. Springboot
=======================================================================================
public class PageResponse<T> {
intpageNum;
intpageSize;
inttotalPages;
List<T>content;
publicPageResponse(Page<T>paged){
if(Optional.ofNullable(paged).isPresent()){
this.pageNum=paged.getNumber();
this.pageSize=paged.getSize();
this.totalPages=paged.getTotalPages();
this.content=paged.getContent();
}
}
publicintgetPageNum(){
returnpageNum;
}
publicvoidsetPageNum(intpageNum){
this.pageNum=pageNum;
}
publicintgetPageSize(){
returnpageSize;
}
publicvoidsetPageSize(intpageSize){
this.pageSize=pageSize;
}
publicintgetTotalPages(){
returntotalPages;
}
publicvoidsetTotalPages(inttotalPages){
this.totalPages=totalPages;
}
publicList<T>getContent(){
returncontent;
}
publicvoidsetContent(List<T>content){
this.content=content;
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps