001package io.ebean; 002 003import javax.annotation.Nonnull; 004import java.util.Collections; 005import java.util.List; 006import java.util.concurrent.Future; 007 008/** 009 * An empty PagedList. 010 * <p> 011 * For use in application code when we need to return a PagedList but don't want to 012 * execute a query. 013 * </p> 014 * 015 * <pre>{@code 016 * 017 * PagedList<Customer> empty = PagedList.emptyList(); 018 * 019 * }</pre> 020 */ 021public class EmptyPagedList<T> implements PagedList<T> { 022 023 @Override 024 public void loadCount() { 025 // do nothing 026 } 027 028 @Nonnull 029 @Override 030 public Future<Integer> getFutureCount() { 031 return null; 032 } 033 034 @Nonnull 035 @Override 036 public List<T> getList() { 037 return Collections.emptyList(); 038 } 039 040 @Override 041 public int getTotalCount() { 042 return 0; 043 } 044 045 @Override 046 public int getTotalPageCount() { 047 return 0; 048 } 049 050 @Override 051 public int getPageSize() { 052 return 0; 053 } 054 055 @Override 056 public int getPageIndex() { 057 return 0; 058 } 059 060 @Override 061 public boolean hasNext() { 062 return false; 063 } 064 065 @Override 066 public boolean hasPrev() { 067 return false; 068 } 069 070 @Override 071 public String getDisplayXtoYofZ(String to, String of) { 072 return ""; 073 } 074}