KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > types > Db4oCollections


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o.types;
22
23 /**
24  * factory and other methods for database-aware collections.
25  */

26 public interface Db4oCollections {
27     
28     /**
29      * creates a new database-aware linked list.
30      * <br><br>Usage:<br>
31      * - declare a <code>java.util.List</code> variable in your persistent class.<br>
32      * - fill this variable with this method.<br><br>
33      * <b>Example:</b><br><br>
34      * <code><pre>
35      * class MyClass{
36      * List myList;
37      * }
38      *
39      * MyClass myObject = new MyClass();
40      * myObject.myList = objectContainer.ext().collections().newLinkedList();</pre></code><br><br>
41      * @return {@link Db4oList}
42      * @see Db4oList
43      */

44     public Db4oList newLinkedList();
45     
46     
47     /**
48      * creates a new database-aware HashMap.
49      * <br><br>
50      * This map will call the hashCode() method on the key objects to calculate the
51      * hash value. Since the hash value is stored to the ObjectContainer, key objects
52      * will have to return the same hashCode() value in every VM session.
53      * <br><br>
54      * Usage:<br>
55      * - declare a <code>java.util.Map</code> variable in your persistent class.<br>
56      * - fill the variable with this method.<br><br>
57      * <b>Example:</b><br><br>
58      * <code><pre>
59      * class MyClass{
60      * Map myMap;
61      * }
62      *
63      * MyClass myObject = new MyClass();
64      * myObject.myMap = objectContainer.ext().collections().newHashMap(0);</pre></code><br><br>
65      * @param initialSize the initial size of the HashMap
66      * @return {@link Db4oMap}
67      * @see Db4oMap
68      */

69     public Db4oMap newHashMap(int initialSize);
70     
71     
72     /**
73      * creates a new database-aware IdentityHashMap.
74      * <br><br>
75      * Only first class objects already stored to the ObjectContainer (Objects with a db4o ID)
76      * can be used as keys for this type of Map. The internal db4o ID will be used as
77      * the hash value.
78      * <br><br>
79      * Usage:<br>
80      * - declare a <code>java.util.Map</code> variable in your persistent class.<br>
81      * - fill the variable with this method.<br><br>
82      * <b>Example:</b><br><br>
83      * <code><pre>
84      * class MyClass{
85      * Map myMap;
86      * }
87      *
88      * MyClass myObject = new MyClass();
89      * myObject.myMap = objectContainer.ext().collections().newIdentityMap(0);</pre></code><br><br>
90      * @param initialSize the initial size of the HashMap
91      * @return {@link Db4oMap}
92      * @see Db4oMap
93      */

94     public Db4oMap newIdentityHashMap(int initialSize);
95     
96     
97
98 }
99
Popular Tags