GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / src / persistence / grails / orm / PagedResultList.java
blob2dc267eb46e1d70c8f0e8a6e0c33d5e5185430c6
1 /*
2 * Copyright 2004-2005 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package grails.orm;
18 import java.util.List;
19 import java.util.Iterator;
20 import java.util.Collection;
21 import java.util.ListIterator;
22 import java.io.Serializable;
24 /**
25 * A result list for Criteria list calls, which is aware of the totalCount for the paged result
27 * @author Siegfried Puchbauer
28 * @since 1.0
30 public class PagedResultList implements List, Serializable {
32 protected List list;
34 protected int totalCount;
36 public PagedResultList(List list) {
37 this.list = list;
40 public PagedResultList(List list, int totalCount) {
41 this.list = list;
42 this.totalCount = totalCount;
45 public int size() {
46 return list.size();
49 public boolean isEmpty() {
50 return list.isEmpty();
53 public boolean contains(Object o) {
54 return list.contains(o);
57 public Iterator iterator() {
58 return list.iterator();
61 public Object[] toArray() {
62 return list.toArray();
65 public Object[] toArray(Object[] objects) {
66 return list.toArray(objects);
69 public boolean add(Object o) {
70 return list.add(o);
73 public boolean remove(Object o) {
74 return list.remove(o);
77 public boolean containsAll(Collection collection) {
78 return list.containsAll(collection);
81 public boolean addAll(Collection collection) {
82 return list.addAll(collection);
85 public boolean addAll(int i, Collection collection) {
86 return list.addAll(i, collection);
89 public boolean removeAll(Collection collection) {
90 return list.removeAll(collection);
93 public boolean retainAll(Collection collection) {
94 return list.retainAll(collection);
97 public void clear() {
98 list.clear();
101 public boolean equals(Object o) {
102 return list.equals(o);
105 public int hashCode() {
106 return list.hashCode();
109 public Object get(int i) {
110 return list.get(i);
113 public Object set(int i, Object o) {
114 return list.set(i, o);
117 public void add(int i, Object o) {
118 list.add(i, o);
121 public Object remove(int i) {
122 return list.remove(i);
125 public int indexOf(Object o) {
126 return list.indexOf(o);
129 public int lastIndexOf(Object o) {
130 return list.lastIndexOf(o);
133 public ListIterator listIterator() {
134 return list.listIterator();
137 public ListIterator listIterator(int i) {
138 return list.listIterator(i);
141 public List subList(int i, int i1) {
142 return list.subList(i, i1);
145 public int getTotalCount() {
146 return totalCount;
149 public void setTotalCount(int totalCount) {
150 this.totalCount = totalCount;