KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > util > collections > ManageableArrayList


1 package org.apache.ojb.broker.util.collections;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import org.apache.ojb.broker.ManageableCollection;
19 import org.apache.ojb.broker.PersistenceBroker;
20 import org.apache.ojb.broker.PersistenceBrokerException;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.Iterator JavaDoc;
24
25 /**
26  * is a utility class. provides an ArrayList that addionally implements
27  * the ManageableCollection interface. This class may be used
28  * as a type for collection attributes.
29  *
30  * @author <a HREF="mailto:thma@apache.org">Thomas Mahler<a>
31  * @version $Id: ManageableArrayList.java,v 1.7.2.1 2005/12/21 22:28:15 tomdz Exp $
32  */

33 public class ManageableArrayList extends ArrayList JavaDoc implements ManageableCollection
34 {
35     /**
36      * add a single Object to the Collection. This method is used during reading Collection elements
37      * from the database. Thus it is is save to cast anObject to the underlying element type of the
38      * collection.
39      */

40     public void ojbAdd(Object JavaDoc anObject)
41     {
42         this.add(anObject);
43     }
44
45     /**
46      * adds a Collection to this collection. Used in reading Extents from the Database.
47      * Thus it is save to cast otherCollection to this.getClass().
48      */

49     public void ojbAddAll(ManageableCollection otherCollection)
50     {
51         this.addAll((ManageableArrayList) otherCollection);
52     }
53
54     public void afterStore(PersistenceBroker broker) throws PersistenceBrokerException
55     {
56         //do nothing
57
}
58
59     /**
60      * returns an Iterator over all elements in the collection. Used during store and delete Operations.
61      * If the implementor does not return an iterator over ALL elements, OJB cannot store and delete all elements properly.
62      *
63      */

64     public Iterator JavaDoc ojbIterator()
65     {
66         return this.iterator();
67     }
68 }
69
Popular Tags