Package com.db4o.internal
Class Config4Class
- java.lang.Object
-
- com.db4o.internal.Config4Abstract
-
- com.db4o.internal.Config4Class
-
- All Implemented Interfaces:
ObjectClass
,DeepClone
public class Config4Class extends Config4Abstract implements ObjectClass, DeepClone
-
-
Field Summary
-
Fields inherited from class com.db4o.internal.Config4Abstract
_config
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Config4Class(Config4Impl configuration, KeySpecHashtable4 config)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
adjustActivationDepth(int depth)
TernaryBool
callConstructor()
void
callConstructor(boolean flag)
advises db4o to try instantiating objects of this class with/without calling constructors.void
compare(ObjectAttribute comparator)
Deprecated.java.lang.Object
deepClone(java.lang.Object param)
The parameter allows passing one new object so parent references can be corrected on children.void
enableReplication(boolean setting)
Must be called before databases are created or opened so that db4o will control versions and generate UUIDs for objects of this class, which is required for using replication.void
generateUUIDs(boolean setting)
generate UUIDs for stored objects of this class.void
generateVersionNumbers(boolean setting)
generate version numbers for stored objects of this class.ObjectTranslator
getTranslator()
boolean
indexed()
void
indexed(boolean flag)
turns the class index on or off.void
maximumActivationDepth(int depth)
sets the maximum activation depth to the desired value.int
minimumActivationDepth()
gets the configured minimum activation depth.void
minimumActivationDepth(int depth)
sets the minimum activation depth to the desired value.ObjectField
objectField(java.lang.String fieldName)
returns anObjectField
object to configure the specified field.void
persistStaticFieldValues()
turns on storing static field values for this class.ObjectAttribute
queryAttributeProvider()
void
rename(java.lang.String newName)
renames a stored class.boolean
storeTransientFields()
void
storeTransientFields(boolean flag)
allows to specify if transient fields are to be stored.void
translate(ObjectTranslator translator)
registers a translator for this class.void
updateDepth(int depth)
specifies the updateDepth for this class.-
Methods inherited from class com.db4o.internal.Config4Abstract
cascadeOnActivate, cascadeOnActivate, cascadeOnDelete, cascadeOnDelete, cascadeOnUpdate, cascadeOnUpdate, equals, getName, hashCode, putThreeValued, putThreeValuedInt, setName
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.db4o.config.ObjectClass
cascadeOnActivate, cascadeOnDelete, cascadeOnUpdate
-
-
-
-
Constructor Detail
-
Config4Class
protected Config4Class(Config4Impl configuration, KeySpecHashtable4 config)
-
-
Method Detail
-
adjustActivationDepth
public int adjustActivationDepth(int depth)
-
callConstructor
public void callConstructor(boolean flag)
Description copied from interface:ObjectClass
advises db4o to try instantiating objects of this class with/without calling constructors.
Not all JDKs / .NET-environments support this feature. db4o will attempt, to follow the setting as good as the environment supports. In doing so, it may call implementation-specific features like sun.reflect.ReflectionFactory#newConstructorForSerialization on the Oracle JVM (not available on other VMs) and FormatterServices.GetUninitializedObject() on the .NET framework (not available on CompactFramework).
This setting may also be set globally for all classes inCommonConfiguration.callConstructors(boolean)
.
In client-server environment this setting should be used on both client and server.- Specified by:
callConstructor
in interfaceObjectClass
- Parameters:
flag
- - specify true, to request calling constructors, specify false to request not calling constructors.- See Also:
Configuration.callConstructors(boolean)
-
compare
public void compare(ObjectAttribute comparator)
Deprecated.Description copied from interface:ObjectClass
registers an attribute provider for special query behavior.
The query processor will compare the object returned by the attribute provider instead of the actual object, both for the constraint and the candidate persistent object.
In client-server environment this setting should be used on both client and server.- Specified by:
compare
in interfaceObjectClass
- Parameters:
comparator
- the attribute provider to be used
-
deepClone
public java.lang.Object deepClone(java.lang.Object param)
Description copied from interface:DeepClone
The parameter allows passing one new object so parent references can be corrected on children.
-
enableReplication
public void enableReplication(boolean setting)
Description copied from interface:ObjectClass
Must be called before databases are created or opened so that db4o will control versions and generate UUIDs for objects of this class, which is required for using replication.- Specified by:
enableReplication
in interfaceObjectClass
-
generateUUIDs
public void generateUUIDs(boolean setting)
Description copied from interface:ObjectClass
generate UUIDs for stored objects of this class. This setting should be used before the database is first created.- Specified by:
generateUUIDs
in interfaceObjectClass
-
generateVersionNumbers
public void generateVersionNumbers(boolean setting)
Description copied from interface:ObjectClass
generate version numbers for stored objects of this class. This setting should be used before the database is first created.- Specified by:
generateVersionNumbers
in interfaceObjectClass
-
getTranslator
public ObjectTranslator getTranslator()
-
indexed
public void indexed(boolean flag)
Description copied from interface:ObjectClass
turns the class index on or off.
db4o maintains an index for each class to be able to deliver all instances of a class in a query. If the class index is never needed, it can be turned off with this method to improve the performance to create and delete objects of a class.
Common cases where a class index is not needed:
- The application always works with sub classes or super classes.
- There are convenient field indexes that will always find instances of a class.
- The application always works with IDs.
In client-server environment this setting should be used on both client and server.
This setting can be applied to an open object container.- Specified by:
indexed
in interfaceObjectClass
-
indexed
public boolean indexed()
-
maximumActivationDepth
public void maximumActivationDepth(int depth)
Description copied from interface:ObjectClass
sets the maximum activation depth to the desired value.
A class specific setting overrides theglobal setting
In client-server environment this setting should be used on both client and server.
This setting can be applied to an open object container.- Specified by:
maximumActivationDepth
in interfaceObjectClass
- Parameters:
depth
- the desired maximum activation depth- See Also:
Why activation?
,ObjectClass.cascadeOnActivate(boolean)
-
minimumActivationDepth
public void minimumActivationDepth(int depth)
Description copied from interface:ObjectClass
sets the minimum activation depth to the desired value.
A class specific setting overrides theglobal setting
In client-server environment this setting should be used on both client and server.
This setting can be applied to an open object container.- Specified by:
minimumActivationDepth
in interfaceObjectClass
- Parameters:
depth
- the desired minimum activation depth- See Also:
Why activation?
,ObjectClass.cascadeOnActivate(boolean)
-
minimumActivationDepth
public int minimumActivationDepth()
Description copied from interface:ObjectClass
gets the configured minimum activation depth. In client-server environment this setting should be used on both client and server.- Specified by:
minimumActivationDepth
in interfaceObjectClass
- Returns:
- the configured minimum activation depth.
-
callConstructor
public TernaryBool callConstructor()
-
objectField
public ObjectField objectField(java.lang.String fieldName)
Description copied from interface:ObjectClass
- Specified by:
objectField
in interfaceObjectClass
- Parameters:
fieldName
- the name of the field to be configured.- Returns:
- an instance of an
ObjectField
object for configuration.
-
persistStaticFieldValues
public void persistStaticFieldValues()
Description copied from interface:ObjectClass
turns on storing static field values for this class.
By default, static field values of classes are not stored to the database file. By turning the setting on for a specific class with this switch, all non-simple-typed static field values of this class are stored the first time an object of the class is stored, and restored, every time a database file is opened afterwards, after class meta information is loaded for this class (which can happen by querying for a class or by loading an instance of a class).
To update a static field value, once it is stored, you have to the following in this order:
(1) open the database file you are working against
(2) make sure the class metadata is loaded
objectContainer.query().constrain(Foo.class); // Java
objectContainer.Query().Constrain(typeof(Foo)); // C#
(3) change the static member
(4) store the static member explicitly
objectContainer.store(Foo.staticMember); // Java
The setting will be ignored for simple types.
Use this setting for constant static object members.
This option will slow down the process of opening database files and the stored objects will occupy space in the database file.
In client-server environment this setting should be used on both client and server.
This setting can NOT be applied to an open object container.- Specified by:
persistStaticFieldValues
in interfaceObjectClass
-
rename
public void rename(java.lang.String newName)
Description copied from interface:ObjectClass
renames a stored class.
Use this method to refactor classes.
In client-server environment this setting should be used on both client and server.
This setting can NOT be applied to an open object container.- Specified by:
rename
in interfaceObjectClass
- Parameters:
newName
- the new fully qualified class name.
-
storeTransientFields
public void storeTransientFields(boolean flag)
Description copied from interface:ObjectClass
allows to specify if transient fields are to be stored.
The default for every class is false.
In client-server environment this setting should be used on both client and server.
This setting can be applied to an open object container.- Specified by:
storeTransientFields
in interfaceObjectClass
- Parameters:
flag
- whether or not transient fields are to be stored.
-
translate
public void translate(ObjectTranslator translator)
Description copied from interface:ObjectClass
registers a translator for this class.
The use of anObjectTranslator
is not compatible with the use of an internal class ObjectMarshaller.
In client-server environment this setting should be used on both client and server.
This setting can be applied to an open object container.- Specified by:
translate
in interfaceObjectClass
- Parameters:
translator
- this may be anObjectTranslator
or anObjectConstructor
- See Also:
ObjectTranslator
,ObjectConstructor
-
updateDepth
public void updateDepth(int depth)
Description copied from interface:ObjectClass
specifies the updateDepth for this class.
see the documentation ofObjectContainer.store(Object)
for further details.
The default setting is 0: Only the object passed toObjectContainer.store(Object)
will be updated.
In client-server environment this setting should be used on both client and server.- Specified by:
updateDepth
in interfaceObjectClass
- Parameters:
depth
- the depth of the desired update for this class.- See Also:
Configuration.updateDepth(int)
,ObjectClass.cascadeOnUpdate(boolean)
,ObjectField.cascadeOnUpdate(boolean)
,Using callbacks
-
queryAttributeProvider
public ObjectAttribute queryAttributeProvider()
-
storeTransientFields
public boolean storeTransientFields()
-
-