KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > ext > StoredField


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.ext;
22
23 import com.db4o.foundation.*;
24 import com.db4o.reflect.*;
25
26
27 /**
28  * the internal representation of a field on a stored class.
29  */

30 public interface StoredField {
31     
32     /**
33      * returns the field value on the passed object.
34      * <br><br>This method will also work, if the field is not present in the current
35      * version of the class.
36      * <br><br>It is recommended to use this method for refactoring purposes, if fields
37      * are removed and the field values need to be copied to other fields.
38      */

39     public Object JavaDoc get(Object JavaDoc onObject);
40     
41     
42     /**
43      * returns the name of the field.
44      */

45     public String JavaDoc getName();
46     
47     
48     /**
49      * returns the Class (Java) / Type (.NET) of the field.
50      * <br><br>For array fields this method will return the type of the array.
51      * Use {link #isArray()} to detect arrays.
52      */

53     public ReflectClass getStoredType();
54     
55     
56     /**
57      * returns true if the field is an array.
58      */

59     public boolean isArray();
60     
61     /**
62      * modifies the name of this stored field.
63      * <br><br>After renaming one or multiple fields the ObjectContainer has
64      * to be closed and reopened to allow internal caches to be refreshed.<br><br>
65      * @param name the new name
66      */

67     public void rename(String JavaDoc name);
68     
69     
70     /**
71      * specialized highspeed API to collect all values of a field for all instances
72      * of a class, if the field is indexed.
73      * <br><br>The field values will be taken directly from the index without the
74      * detour through class indexes or object instantiation.
75      * <br><br>
76      * If this method is used to get the values of a first class object index,
77      * deactivated objects will be passed to the visitor.
78      *
79      * @param visitor the visitor to be called with each index value.
80      */

81     public void traverseValues(Visitor4 visitor);
82     
83     /**
84      * Returns whether this field has an index or not.
85      * @return true if this field has an index.
86      */

87     public boolean hasIndex();
88
89 // will need for replication. Requested for 3.0
90
//
91
// /**
92
// * sets the field value on the passed object.
93
// * @param onObject
94
// * @param fieldValue
95
// */
96
// public void set(Object onObject, Object fieldValue);
97
}
98
Popular Tags