KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > config > ObjectField


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.config;
22 /**
23  * configuration interface for fields of classes.
24  * <br><br><b>Examples: ../com/db4o/samples/translators.</b><br><br>
25  * Use the global Configuration object to configure db4o before opening an
26  * {@link com.db4o.ObjectContainer ObjectContainer}.<br><br>
27  * <b>Example:</b><br>
28  * <code>
29  * Configuration config = Db4o.configure();<br>
30  * ObjectClass oc = config.objectClass("package.className");<br>
31  * ObjectField of = oc.objectField("fieldName");
32  * of.rename("newFieldName");
33  * of.queryEvaluation(false);
34  * </code>
35  */

36 public interface ObjectField {
37     
38     /**
39      * sets cascaded activation behaviour.
40      * <br><br>
41      * Setting cascadeOnActivate to true will result in the activation
42      * of the object attribute stored in this field if the parent object
43      * is activated.
44      * <br><br>
45      * The default setting is <b>false</b>.<br><br>
46      * @param flag whether activation is to be cascaded to the member object.
47      * @see Configuration#activationDepth Why activation?
48      * @see ObjectClass#cascadeOnActivate
49      * @see com.db4o.ObjectContainer#activate
50      * @see com.db4o.ext.ObjectCallbacks Using callbacks
51      */

52     public void cascadeOnActivate(boolean flag);
53     
54     
55     /**
56      * sets cascaded delete behaviour.
57      * <br><br>
58      * Setting cascadeOnDelete to true will result in the deletion of
59      * the object attribute stored in this field on the parent object
60      * if the parent object is passed to
61      * {@link com.db4o.ObjectContainer#delete ObjectContainer#delete()}.
62      * <br><br>
63      * <b>Caution !</b><br>
64      * This setting will also trigger deletion of the old member object, on
65      * calls to {@link com.db4o.ObjectContainer#set ObjectContainer#set()}.
66      * An example of the behaviour can be found in
67      * {@link ObjectClass#cascadeOnDelete ObjectClass#cascadeOnDelete()}
68      * <br><br>
69      * The default setting is <b>false</b>.<br><br>
70      * @param flag whether deletes are to be cascaded to the member object.
71      * @see ObjectClass#cascadeOnDelete
72      * @see com.db4o.ObjectContainer#delete
73      * @see com.db4o.ext.ObjectCallbacks Using callbacks
74      */

75     public void cascadeOnDelete(boolean flag);
76     
77     
78     /**
79      * sets cascaded update behaviour.
80      * <br><br>
81      * Setting cascadeOnUpdate to true will result in the update
82      * of the object attribute stored in this field if the parent object
83      * is passed to
84      * {@link com.db4o.ObjectContainer#set ObjectContainer#set()}.
85      * <br><br>
86      * The default setting is <b>false</b>.<br><br>
87      * @param flag whether updates are to be cascaded to the member object.
88      * @see com.db4o.ObjectContainer#set
89      * @see ObjectClass#cascadeOnUpdate
90      * @see ObjectClass#updateDepth
91      * @see com.db4o.ext.ObjectCallbacks Using callbacks
92      */

93     public void cascadeOnUpdate(boolean flag);
94     
95     
96     /**
97      * turns indexing on or off.
98      * <br><br>Field indices dramatically improve query performance but they may
99      * considerably reduce storage and update performance.<br>The best benchmark whether
100      * or not an index on a field achieves the desired result is the completed application
101      * - with a data load that is typical for it's use.<br><br>This configuration setting
102      * is only checked when the {@link com.db4o.ObjectContainer} is opened. If the
103      * setting is set to <code>true</code> and an index does not exist, the index will be
104      * created. If the setting is set to <code>false</code> and an index does exist the
105      * index will be dropped.<br><br>
106      * @param flag specify <code>true</code> or <code>false</code> to turn indexing on for
107      * this field
108      */

109     public void indexed(boolean flag);
110     
111
112     /**
113      * renames a field of a stored class.
114      * <br><br>Use this method to refactor classes.
115      * <br><br><b>Examples: ../com/db4o/samples/rename.</b><br><br>
116      * @param newName the new fieldname.
117      */

118     public void rename (String JavaDoc newName);
119
120
121     /**
122      * toggles query evaluation.
123      * <br><br>All fields are evaluated by default. Use this method to turn query
124      * evaluation of for specific fields.<br><br>
125      * @param flag specify <code>false</code> to ignore this field during query evaluation.
126      */

127     public void queryEvaluation (boolean flag);
128 }
129
Popular Tags