Azeez, it is very easy to come up with a AbstractClass with the first
two methods, am I missing something???
Ruwan
Afkham Azeez wrote:
> For instance, look at these impl methods in service-mgt BE:
>
> public int getNumberOfPages() {
> return numberOfPages;
> }
>
> public void setNumberOfPages(int numberOfPages) {
> this.numberOfPages = numberOfPages;
> }
>
> public <T> void set(List<T> items) {
> this.serviceGroups = items.toArray(new
> ServiceGroupMetaData[items.size()]);
> }
>
>
> Azeez
>
> On Thu, May 6, 2010 at 11:07 AM, Ruwan Linton <[email protected]
> <mailto:[email protected]>> wrote:
>
> Sumedha Rubasinghe wrote:
> > Pageable kind of gives a wrong idea.. isn't it?
> > How about 'Paginator' ?
> +1, Pageable is more likely a markable interface, and for example
> services, sequences should be pageable, but that is not what we
> want to
> achieve with this interface write.
>
> Paginator looks OK.
>
> BTW: is there any default implementation or at least an abstract class
> implementing the first 2 methods in a standard manner? If not we
> should
> be able to come up with a one.
>
> Thanks,
> Ruwan
> > /sumedha
> >
> > On Thu, May 6, 2010 at 10:12 AM, Afkham Azeez <[email protected]
> <mailto:[email protected]>
> > <mailto:[email protected] <mailto:[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] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[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] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>
> > https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Carbon-dev mailing list
> > [email protected] <mailto:[email protected]>
> > https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >
>
>
> --
> Ruwan Linton
> Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.com
>
> Lean . Enterprise . Middleware
>
> phone: +1 408 754 7388 ext 51789
> email: [email protected] <mailto:[email protected]>; cell: +94 77 341 3097
> blog: http://blog.ruwan.org
> linkedin: http://www.linkedin.com/in/ruwanlinton
> tweet: http://twitter.com/ruwanlinton
>
>
> _______________________________________________
> Carbon-dev mailing list
> [email protected] <mailto:[email protected]>
> https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>
>
>
> --
> 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] <mailto:[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
>
--
Ruwan Linton
Software Architect & Product Manager, WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.com
Lean . Enterprise . Middleware
phone: +1 408 754 7388 ext 51789
email: [email protected]; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
tweet: http://twitter.com/ruwanlinton
_______________________________________________
Carbon-dev mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev