db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/collections ManageableTreeSet.java
Date Fri, 23 Jul 2004 07:28:55 GMT
tomdz       2004/07/23 00:28:54

  Added:       src/java/org/apache/ojb/broker/util/collections
                        ManageableTreeSet.java
  Log:
  Added manageable tree set implementation from David Zejda
  
  Revision  Changes    Path
  1.1                  db-ojb/src/java/org/apache/ojb/broker/util/collections/ManageableTreeSet.java
  
  Index: ManageableTreeSet.java
  ===================================================================
  package org.apache.ojb.broker.util.collections;
  
  /* Copyright 2002-2004 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
  
  import java.util.TreeSet;
  import java.util.Iterator;
  
  import org.apache.ojb.broker.ManageableCollection;
  import org.apache.ojb.broker.PersistenceBroker;
  import org.apache.ojb.broker.PersistenceBrokerException;
  
  /**
  * is a utility class. provides a SortedSet that addionally implements
  * the ManageableCollection interface. This class may be used
  * as a type for collection attributes.
  *
  * @author <a href="mailto:dvid@atlas.cz">David Zejda<a>
  */
  public class ManageableTreeSet extends TreeSet implements ManageableCollection
  {
     /**
      * add a single Object to the Collection. This method is used during reading Collection
elements
      * from the database. Thus it is is save to cast anObject to the underlying element type
of the
      * collection.
      */
     public void ojbAdd(Object anObject)
     {
         super.add(anObject);
     }
  
     /**
      * adds a Collection to this collection. Used in reading Extents from the Database.
      * Thus it is save to cast otherCollection to this.getClass().
      */
     public void ojbAddAll(ManageableCollection otherCollection)
     {
         super.addAll((ManageableTreeSet) otherCollection);
     }
  
     public void afterStore(PersistenceBroker broker) throws PersistenceBrokerException
     {
         //do nothing
     }
  
     /**
      * returns an Iterator over all elements in the collection. Used during store and delete
Operations.
      * If the implementor does not return an iterator over ALL elements, OJB cannot store
and delete all elements properly.
      *
      */
     public Iterator ojbIterator()
     {
         return super.iterator();
     }
  } 
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message