com.db4o.config.ObjectField Maven / Gradle / Ivy
The newest version!
/* Copyright (C) 2004 - 2005 db4objects Inc. http://www.db4o.com
This file is part of the db4o open source object database.
db4o is free software; you can redistribute it and/or modify it under
the terms of version 2 of the GNU General Public License as published
by the Free Software Foundation and as clarified by db4objects' GPL
interpretation policy, available at
http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
Suite 350, San Mateo, CA 94403, USA.
db4o is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
package com.db4o.config;
/**
* configuration interface for fields of classes.
*
Examples: ../com/db4o/samples/translators.
* Use the global Configuration object to configure db4o before opening an
* {@link com.db4o.ObjectContainer ObjectContainer}.
* Example:
*
* Configuration config = Db4o.configure();
* ObjectClass oc = config.objectClass("package.className");
* ObjectField of = oc.objectField("fieldName");
* of.rename("newFieldName");
* of.queryEvaluation(false);
*
*/
public interface ObjectField {
/**
* sets cascaded activation behaviour.
*
* Setting cascadeOnActivate to true will result in the activation
* of the object attribute stored in this field if the parent object
* is activated.
*
* The default setting is false.
* @param flag whether activation is to be cascaded to the member object.
* @see Configuration#activationDepth Why activation?
* @see ObjectClass#cascadeOnActivate
* @see com.db4o.ObjectContainer#activate
* @see com.db4o.ext.ObjectCallbacks Using callbacks
*/
public void cascadeOnActivate(boolean flag);
/**
* sets cascaded delete behaviour.
*
* Setting cascadeOnDelete to true will result in the deletion of
* the object attribute stored in this field on the parent object
* if the parent object is passed to
* {@link com.db4o.ObjectContainer#delete ObjectContainer#delete()}.
*
* Caution !
* This setting will also trigger deletion of the old member object, on
* calls to {@link com.db4o.ObjectContainer#set ObjectContainer#set()}.
* An example of the behaviour can be found in
* {@link ObjectClass#cascadeOnDelete ObjectClass#cascadeOnDelete()}
*
* The default setting is false.
* @param flag whether deletes are to be cascaded to the member object.
* @see ObjectClass#cascadeOnDelete
* @see com.db4o.ObjectContainer#delete
* @see com.db4o.ext.ObjectCallbacks Using callbacks
*/
public void cascadeOnDelete(boolean flag);
/**
* sets cascaded update behaviour.
*
* Setting cascadeOnUpdate to true will result in the update
* of the object attribute stored in this field if the parent object
* is passed to
* {@link com.db4o.ObjectContainer#set ObjectContainer#set()}.
*
* The default setting is false.
* @param flag whether updates are to be cascaded to the member object.
* @see com.db4o.ObjectContainer#set
* @see ObjectClass#cascadeOnUpdate
* @see ObjectClass#updateDepth
* @see com.db4o.ext.ObjectCallbacks Using callbacks
*/
public void cascadeOnUpdate(boolean flag);
/**
* turns indexing on or off.
*
Field indices dramatically improve query performance but they may
* considerably reduce storage and update performance.
The best benchmark whether
* or not an index on a field achieves the desired result is the completed application
* - with a data load that is typical for it's use.
This configuration setting
* is only checked when the {@link com.db4o.ObjectContainer} is opened. If the
* setting is set to true
and an index does not exist, the index will be
* created. If the setting is set to false
and an index does exist the
* index will be dropped.
* @param flag specify true
or false
to turn indexing on for
* this field
*/
public void indexed(boolean flag);
/**
* renames a field of a stored class.
*
Use this method to refactor classes.
*
Examples: ../com/db4o/samples/rename.
* @param newName the new fieldname.
*/
public void rename (String newName);
/**
* toggles query evaluation.
*
All fields are evaluated by default. Use this method to turn query
* evaluation of for specific fields.
* @param flag specify false
to ignore this field during query evaluation.
*/
public void queryEvaluation (boolean flag);
}