Pageable kind of gives a wrong idea.. isn't it?
How about 'Paginator' ?
/sumedha

On Thu, May 6, 2010 at 10:12 AM, Afkham Azeez <[email protected]> wrote:

> Hi folks,
> I have introduced a method into org.wso2.carbon.utils.Utils;
>
> /**
>      * A reusable generic method for doing item paging
>      *
>      * @param pageNumber The page required. Page number starts with 0.
>      * @param sourceList The original list of items
>      * @param pageable          The type of Pageable item
>      * @return Returned page
>      */
>     public static <C> List<C> doPaging(int pageNumber, List<C> sourceList,
> Pageable pageable) ;
>
> This will set & return a page (a sub-list) of items of the sourceList. You
> need to pass in a class implementing org.wso2.carbon.utils.Pageable. This
> interface is as follows:
>
> public interface Pageable {
>
>     /**
>      * Get the total number of pages
>      *
>      * @return  the total number of pages
>      */
>     public int getNumberOfPages();
>
>     /**
>      * Set the total number of pages
>      *
>      * @param numberOfPages The total number of pages
>      */
>     public void setNumberOfPages(int numberOfPages);
>
>     /**
>      * Set the paged items
>      *
>      * @param t The collection
>      * @param <T> The type of objects in the collection
>      */
>     public <T extends Object> void set(List<T> t);
> }
>
> Please make sure that you reuse this code to do item paging. This is
> generally done at the BE.
>
> --
> Afkham Azeez
> Software Architect & Product Manager, WSO2 WSAS; WSO2, Inc.;
> http://wso2.com, Lean . Enterprise . Middleware
> Member; Apache Software Foundation; http://www.apache.org/
> email: [email protected] cell: +94 77 3320919
> blog: http://blog.afkham.org
> twitter: http://twitter.com/afkham_azeez
> linked-in: http://lk.linkedin.com/in/afkhamazeez
>
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>
_______________________________________________
Carbon-dev mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to