001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
003: * JR Boyens <gnu-jrb[remove] at gmx dot net>
004: * Distributed under the terms of either:
005: * - the common development and distribution license (CDDL), v1.0; or
006: * - the GNU Lesser General Public License, v2.1 or later
007: * $Id: ManyToOneAssociationList.java 3716 2007-04-11 06:21:18Z gbevin $
008: */
009: package com.uwyn.rife.database.querymanagers.generic;
010:
011: import java.util.Collection;
012: import java.util.Iterator;
013: import java.util.List;
014: import java.util.ListIterator;
015:
016: class ManyToOneAssociationList<E> extends
017: AbstractManyToOneAssociationCollection<E> implements List<E> {
018: private List<E> mDelegate;
019:
020: ManyToOneAssociationList(AbstractGenericQueryManager manager,
021: int objectId, ManyToOneAssociationDeclaration declaration) {
022: super (manager, objectId, declaration);
023: }
024:
025: protected void ensurePopulatedDelegate() {
026: if (null == mDelegate) {
027: mDelegate = restoreManyToOneAssociations();
028: }
029: }
030:
031: public int size() {
032: ensurePopulatedDelegate();
033: return mDelegate.size();
034: }
035:
036: public boolean isEmpty() {
037: ensurePopulatedDelegate();
038: return mDelegate.isEmpty();
039: }
040:
041: public boolean contains(Object o) {
042: ensurePopulatedDelegate();
043: return mDelegate.contains(o);
044: }
045:
046: public Iterator<E> iterator() {
047: ensurePopulatedDelegate();
048: return mDelegate.iterator();
049: }
050:
051: public Object[] toArray() {
052: ensurePopulatedDelegate();
053: return mDelegate.toArray();
054: }
055:
056: public <T extends Object> T[] toArray(T[] a) {
057: ensurePopulatedDelegate();
058: return mDelegate.toArray(a);
059: }
060:
061: public boolean add(E o) {
062: ensurePopulatedDelegate();
063: return mDelegate.add(o);
064: }
065:
066: public boolean remove(Object o) {
067: ensurePopulatedDelegate();
068: return mDelegate.remove(o);
069: }
070:
071: public boolean containsAll(Collection<?> c) {
072: ensurePopulatedDelegate();
073: return mDelegate.containsAll(c);
074: }
075:
076: public boolean addAll(Collection<? extends E> c) {
077: ensurePopulatedDelegate();
078: return mDelegate.addAll(c);
079: }
080:
081: public boolean addAll(int index, Collection<? extends E> c) {
082: ensurePopulatedDelegate();
083: return mDelegate.addAll(index, c);
084: }
085:
086: public boolean removeAll(Collection<?> c) {
087: ensurePopulatedDelegate();
088: return mDelegate.removeAll(c);
089: }
090:
091: public boolean retainAll(Collection<?> c) {
092: ensurePopulatedDelegate();
093: return mDelegate.retainAll(c);
094: }
095:
096: public void clear() {
097: ensurePopulatedDelegate();
098: mDelegate.clear();
099: }
100:
101: public E get(int index) {
102: ensurePopulatedDelegate();
103: return mDelegate.get(index);
104: }
105:
106: public E set(int index, E element) {
107: ensurePopulatedDelegate();
108: return mDelegate.set(index, element);
109: }
110:
111: public void add(int index, E element) {
112: ensurePopulatedDelegate();
113: mDelegate.add(index, element);
114: }
115:
116: public E remove(int index) {
117: ensurePopulatedDelegate();
118: return mDelegate.remove(index);
119: }
120:
121: public int indexOf(Object o) {
122: ensurePopulatedDelegate();
123: return mDelegate.indexOf(o);
124: }
125:
126: public int lastIndexOf(Object o) {
127: ensurePopulatedDelegate();
128: return mDelegate.lastIndexOf(o);
129: }
130:
131: public ListIterator<E> listIterator() {
132: ensurePopulatedDelegate();
133: return mDelegate.listIterator();
134: }
135:
136: public ListIterator<E> listIterator(int index) {
137: ensurePopulatedDelegate();
138: return mDelegate.listIterator(index);
139: }
140:
141: public List<E> subList(int fromIndex, int toIndex) {
142: ensurePopulatedDelegate();
143: return mDelegate.subList(fromIndex, toIndex);
144: }
145: }
|