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 protectedConfig4Class(Config4Impl configuration, KeySpecHashtable4 config)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intadjustActivationDepth(int depth)TernaryBoolcallConstructor()voidcallConstructor(boolean flag)advises db4o to try instantiating objects of this class with/without calling constructors.voidcompare(ObjectAttribute comparator)Deprecated.java.lang.ObjectdeepClone(java.lang.Object param)The parameter allows passing one new object so parent references can be corrected on children.voidenableReplication(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.voidgenerateUUIDs(boolean setting)generate UUIDs for stored objects of this class.voidgenerateVersionNumbers(boolean setting)generate version numbers for stored objects of this class.ObjectTranslatorgetTranslator()booleanindexed()voidindexed(boolean flag)turns the class index on or off.voidmaximumActivationDepth(int depth)sets the maximum activation depth to the desired value.intminimumActivationDepth()gets the configured minimum activation depth.voidminimumActivationDepth(int depth)sets the minimum activation depth to the desired value.ObjectFieldobjectField(java.lang.String fieldName)returns anObjectFieldobject to configure the specified field.voidpersistStaticFieldValues()turns on storing static field values for this class.ObjectAttributequeryAttributeProvider()voidrename(java.lang.String newName)renames a stored class.booleanstoreTransientFields()voidstoreTransientFields(boolean flag)allows to specify if transient fields are to be stored.voidtranslate(ObjectTranslator translator)registers a translator for this class.voidupdateDepth(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:ObjectClassadvises 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:
callConstructorin 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:ObjectClassregisters 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:
comparein interfaceObjectClass- Parameters:
comparator- the attribute provider to be used
-
deepClone
public java.lang.Object deepClone(java.lang.Object param)
Description copied from interface:DeepCloneThe parameter allows passing one new object so parent references can be corrected on children.
-
enableReplication
public void enableReplication(boolean setting)
Description copied from interface:ObjectClassMust 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:
enableReplicationin interfaceObjectClass
-
generateUUIDs
public void generateUUIDs(boolean setting)
Description copied from interface:ObjectClassgenerate UUIDs for stored objects of this class. This setting should be used before the database is first created.- Specified by:
generateUUIDsin interfaceObjectClass
-
generateVersionNumbers
public void generateVersionNumbers(boolean setting)
Description copied from interface:ObjectClassgenerate version numbers for stored objects of this class. This setting should be used before the database is first created.- Specified by:
generateVersionNumbersin interfaceObjectClass
-
getTranslator
public ObjectTranslator getTranslator()
-
indexed
public void indexed(boolean flag)
Description copied from interface:ObjectClassturns 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:
indexedin interfaceObjectClass
-
indexed
public boolean indexed()
-
maximumActivationDepth
public void maximumActivationDepth(int depth)
Description copied from interface:ObjectClasssets 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:
maximumActivationDepthin 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:ObjectClasssets 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:
minimumActivationDepthin interfaceObjectClass- Parameters:
depth- the desired minimum activation depth- See Also:
Why activation?,ObjectClass.cascadeOnActivate(boolean)
-
minimumActivationDepth
public int minimumActivationDepth()
Description copied from interface:ObjectClassgets the configured minimum activation depth. In client-server environment this setting should be used on both client and server.- Specified by:
minimumActivationDepthin 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:
objectFieldin interfaceObjectClass- Parameters:
fieldName- the name of the field to be configured.- Returns:
- an instance of an
ObjectFieldobject for configuration.
-
persistStaticFieldValues
public void persistStaticFieldValues()
Description copied from interface:ObjectClassturns 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:
persistStaticFieldValuesin interfaceObjectClass
-
rename
public void rename(java.lang.String newName)
Description copied from interface:ObjectClassrenames 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:
renamein interfaceObjectClass- Parameters:
newName- the new fully qualified class name.
-
storeTransientFields
public void storeTransientFields(boolean flag)
Description copied from interface:ObjectClassallows 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:
storeTransientFieldsin interfaceObjectClass- Parameters:
flag- whether or not transient fields are to be stored.
-
translate
public void translate(ObjectTranslator translator)
Description copied from interface:ObjectClassregisters a translator for this class.
The use of anObjectTranslatoris 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:
translatein interfaceObjectClass- Parameters:
translator- this may be anObjectTranslatoror anObjectConstructor- See Also:
ObjectTranslator,ObjectConstructor
-
updateDepth
public void updateDepth(int depth)
Description copied from interface:ObjectClassspecifies 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:
updateDepthin 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()
-
-