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.ext;
22:
23: import com.db4o.foundation.*;
24: import com.db4o.reflect.*;
25:
26: /**
27: * the internal representation of a field on a stored class.
28: */
29: public interface StoredField {
30:
31: /**
32: * creates an index on this field at runtime.
33: */
34: public void createIndex();
35:
36: /**
37: * returns the field value on the passed object.
38: * <br><br>This method will also work, if the field is not present in the current
39: * version of the class.
40: * <br><br>It is recommended to use this method for refactoring purposes, if fields
41: * are removed and the field values need to be copied to other fields.
42: */
43: public Object get(Object onObject);
44:
45: /**
46: * returns the name of the field.
47: */
48: public String getName();
49:
50: /**
51: * returns the Class (Java) / Type (.NET) of the field.
52: * <br><br>For array fields this method will return the type of the array.
53: * Use {@link #isArray()} to detect arrays.
54: */
55: public ReflectClass getStoredType();
56:
57: /**
58: * returns true if the field is an array.
59: */
60: public boolean isArray();
61:
62: /**
63: * modifies the name of this stored field.
64: * <br><br>After renaming one or multiple fields the ObjectContainer has
65: * to be closed and reopened to allow internal caches to be refreshed.<br><br>
66: * @param name the new name
67: */
68: public void rename(String name);
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: }
|