generified PagedListHolded (SPR-6825)

master
Juergen Hoeller 15 years ago
parent 09998b2434
commit 5f781e6266
  1. 20
      org.springframework.beans/src/main/java/org/springframework/beans/support/PagedListHolder.java

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,14 +47,14 @@ import org.springframework.util.Assert;
* @see #getPageList()
* @see org.springframework.beans.support.MutableSortDefinition
*/
public class PagedListHolder implements Serializable {
public class PagedListHolder<E> implements Serializable {
public static final int DEFAULT_PAGE_SIZE = 10;
public static final int DEFAULT_MAX_LINKED_PAGES = 10;
private List source;
private List<E> source;
private Date refreshDate;
@ -77,7 +77,7 @@ public class PagedListHolder implements Serializable {
* @see #setSource
*/
public PagedListHolder() {
this(new ArrayList(0));
this(new ArrayList<E>(0));
}
/**
@ -86,7 +86,7 @@ public class PagedListHolder implements Serializable {
* @param source the source List
* @see MutableSortDefinition#setToggleAscendingOnProperty
*/
public PagedListHolder(List source) {
public PagedListHolder(List<E> source) {
this(source, new MutableSortDefinition(true));
}
@ -95,7 +95,7 @@ public class PagedListHolder implements Serializable {
* @param source the source List
* @param sort the SortDefinition to start with
*/
public PagedListHolder(List source, SortDefinition sort) {
public PagedListHolder(List<E> source, SortDefinition sort) {
setSource(source);
setSort(sort);
}
@ -104,7 +104,7 @@ public class PagedListHolder implements Serializable {
/**
* Set the source list for this holder.
*/
public void setSource(List source) {
public void setSource(List<E> source) {
Assert.notNull(source, "Source List must not be null");
this.source = source;
this.refreshDate = new Date();
@ -114,7 +114,7 @@ public class PagedListHolder implements Serializable {
/**
* Return the source list for this holder.
*/
public List getSource() {
public List<E> getSource() {
return this.source;
}
@ -268,7 +268,7 @@ public class PagedListHolder implements Serializable {
/**
* Return a sub-list representing the current page.
*/
public List getPageList() {
public List<E> getPageList() {
return getSource().subList(getFirstElementOnPage(), getLastElementOnPage() + 1);
}
@ -325,7 +325,7 @@ public class PagedListHolder implements Serializable {
* Can be overridden in subclasses.
* @see PropertyComparator#sort(java.util.List, SortDefinition)
*/
protected void doSort(List source, SortDefinition sort) {
protected void doSort(List<E> source, SortDefinition sort) {
PropertyComparator.sort(source, sort);
}

Loading…
Cancel
Save