public Page getPage(Page current, int targetPageNumber){
if(current == null){
log.warn("Current page is null, cannot found target page for pagenumber " + targetPageNumber);
return null;
}
Pager pa = current.getPager();
if(pa == null){
log.warn("Current page is not one of a pigination page.");
return null;
}
int currentPageNumber = pa.getPageNumber();
if(currentPageNumber == targetPageNumber){
return current;
}else if(targetPageNumber > currentPageNumber){
return getPage(pa.getNext(), targetPageNumber);
}else{
return getPage(pa.getPrevious(), targetPageNumber);
}
}