01: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
02:
03: This file is part of the db4o open source object database.
04:
05: db4o is free software; you can redistribute it and/or modify it under
06: the terms of version 2 of the GNU General Public License as published
07: by the Free Software Foundation and as clarified by db4objects' GPL
08: interpretation policy, available at
09: 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: * creates a new database-aware HashMap.
48: * <br><br>
49: * This map will call the hashCode() method on the key objects to calculate the
50: * hash value. Since the hash value is stored to the ObjectContainer, key objects
51: * will have to return the same hashCode() value in every VM session.
52: * <br><br>
53: * Usage:<br>
54: * - declare a <code>java.util.Map</code> variable in your persistent class.<br>
55: * - fill the variable with this method.<br><br>
56: * <b>Example:</b><br><br>
57: * <code><pre>
58: * class MyClass{
59: * Map myMap;
60: * }
61: *
62: * MyClass myObject = new MyClass();
63: * myObject.myMap = objectContainer.ext().collections().newHashMap(0);</pre></code><br><br>
64: * @param initialSize the initial size of the HashMap
65: * @return {@link Db4oMap}
66: * @see Db4oMap
67: */
68: public Db4oMap newHashMap(int initialSize);
69:
70: /**
71: * creates a new database-aware IdentityHashMap.
72: * <br><br>
73: * Only first class objects already stored to the ObjectContainer (Objects with a db4o ID)
74: * can be used as keys for this type of Map. The internal db4o ID will be used as
75: * the hash value.
76: * <br><br>
77: * Usage:<br>
78: * - declare a <code>java.util.Map</code> variable in your persistent class.<br>
79: * - fill the variable with this method.<br><br>
80: * <b>Example:</b><br><br>
81: * <code><pre>
82: * class MyClass{
83: * Map myMap;
84: * }
85: *
86: * MyClass myObject = new MyClass();
87: * myObject.myMap = objectContainer.ext().collections().newIdentityMap(0);</pre></code><br><br>
88: * @param initialSize the initial size of the HashMap
89: * @return {@link Db4oMap}
90: * @see Db4oMap
91: */
92: public Db4oMap newIdentityHashMap(int initialSize);
93:
94: }
|