public interface CommonConfiguration
| Modifier and Type | Method and Description |
|---|---|
int |
activationDepth()
gets the configured activation depth.
|
void |
activationDepth(int depth)
sets the activation depth to the specified value.
|
void |
add(ConfigurationItem configurationItem)
adds ConfigurationItems to be applied when
an ObjectContainer or ObjectServer is opened.
|
void |
addAlias(Alias alias)
adds a new Alias for a class, namespace or package.
|
void |
allowVersionUpdates(boolean flag)
turns automatic database file format version updates on.
|
void |
automaticShutDown(boolean flag)
turns automatic shutdown of the engine on and off.
|
void |
bTreeNodeSize(int size)
configures the size of BTree nodes in indexes.
|
void |
callbacks(boolean flag)
turns callback methods on and off.
|
void |
callConstructors(boolean flag)
advises db4o to try instantiating objects with/without calling
constructors.
|
void |
detectSchemaChanges(boolean flag)
tuning feature: configures whether db4o checks all persistent classes upon system
startup, for added or removed fields.
|
DiagnosticConfiguration |
diagnostic()
returns the configuration interface for diagnostics.
|
EnvironmentConfiguration |
environment() |
void |
exceptionsOnNotStorable(boolean flag)
configures whether Exceptions are to be thrown, if objects can not be stored.
|
void |
internStrings(boolean flag)
configures db4o to call #intern() on strings upon retrieval.
|
void |
markTransient(java.lang.String attributeName)
allows to mark fields as transient with custom annotations/attributes.
|
int |
maxStackDepth()
gets the configured max stack depth.
|
void |
maxStackDepth(int maxStackDepth)
Sets the max stack depth that will be used for recursive storing and activating an object.
|
void |
messageLevel(int level)
sets the detail level of db4o messages.
|
void |
nameProvider(NameProvider provider)
Registers a
NameProvider that assigns a custom name to the database to be used in
Object.toString(). |
ObjectClass |
objectClass(java.lang.Object clazz)
returns an
ObjectClass object
to configure the specified class. |
boolean |
optimizeNativeQueries()
indicates whether Native Queries will be optimized dynamically.
|
void |
optimizeNativeQueries(boolean optimizeNQ)
If set to true, db4o will try to optimize native queries
dynamically at query execution time, otherwise it will
run native queries in unoptimized mode as SODA evaluations.
|
void |
outStream(java.io.PrintStream outStream)
Assigns a
PrintStream where db4o is to print its event messages. |
QueryConfiguration |
queries()
returns the Query configuration interface.
|
void |
reflectWith(Reflector reflector)
configures the use of a specially designed reflection implementation.
|
void |
registerTypeHandler(TypeHandlerPredicate predicate,
TypeHandler4 typeHandler)
allows registering special TypeHandlers for customized marshalling
and customized comparisons.
|
void |
removeAlias(Alias alias)
Removes an alias previously added with
addAlias(Alias). |
void |
stringEncoding(StringEncoding encoding)
configures the string encoding to be used.
|
void |
testConstructors(boolean flag)
tuning feature: configures whether db4o should try to instantiate one instance
of each persistent class on system startup.
|
void |
updateDepth(int depth)
specifies the global updateDepth.
|
void |
weakReferenceCollectionInterval(int milliseconds)
configures the timer for WeakReference collection.
|
void |
weakReferences(boolean flag)
turns weak reference management on or off.
|
void addAlias(Alias alias)
TypeAlias provides an #equals() resolver to match
names directly.WildcardAlias allows simple pattern matching
with one single '*' wildcard character.Alias constructs by creating own resolvers
that implement the Alias interface.
// Creating an Alias for a single class
EmbeddedConfiguration config = Db4oEmbedded.newConfiguration();
config.common().addAlias(
new TypeAlias("com.f1.Pilot", "com.f1.Driver"));
// Mapping a Java package onto another
config.common().addAlias(
new WildcardAlias(
"com.f1.*",
"com.f1.client*"));
void removeAlias(Alias alias)
addAlias(Alias).alias - the alias to removevoid activationDepth(int depth)
ObjectSet of a query result, the result objects
will be activated to the configured activation depth.// Object foo is the result of a query, it is delivered by the ObjectSet Object foo = objectSet.next();foo.member1.member2.member3.member4.member5 will be a valid object
ObjectContainer#activate(member5, depth).
ObjectContainer#deactivate(Object, depth)
can be used to manually free memory by deactivating objects.depth - the desired global activation depth.configuring classes individuallyint activationDepth()
void add(ConfigurationItem configurationItem)
configurationItem - the ConfigurationItemvoid allowVersionUpdates(boolean flag)
void automaticShutDown(boolean flag)
true.flag - whether db4o should shut down automatically.void bTreeNodeSize(int size)
size - the number of elements held in one BTree node.void callbacks(boolean flag)
flag - false to turn callback methods offUsing callbacksvoid callConstructors(boolean flag)
ObjectClass.callConstructor(boolean).
flag - - specify true, to request calling constructors, specify
false to request not calling constructors.ObjectClass.callConstructor(boolean)void detectSchemaChanges(boolean flag)
trueflag - the desired settingDiagnosticConfiguration diagnostic()
void exceptionsOnNotStorable(boolean flag)
ObjectNotStorableException
if an object can not be stored.
flag - true to throw Exceptions if objects can not be stored.void internStrings(boolean flag)
flag - true to intern stringsvoid markTransient(java.lang.String attributeName)
attributeName - - the fully qualified name of the attribute, including
it's namespacevoid messageLevel(int level)
PrintStream.
level - integer from 0 to 3TODO: replace int with enumerationObjectClass objectClass(java.lang.Object clazz)
ObjectClass object
to configure the specified class.
clazz - class name, Class object, or example object.ObjectClass
object for configuration.void optimizeNativeQueries(boolean optimizeNQ)
true.optimizeNQ - true, if db4o should try to optimize
native queries at query execution time, false otherwiseboolean optimizeNativeQueries()
optimizeNativeQueries(boolean)QueryConfiguration queries()
void reflectWith(Reflector reflector)
void outStream(java.io.PrintStream outStream)
PrintStream where db4o is to print its event messages.
Configuration.messageLevel(int)
to produce more detailed messages.
outStream(System.out) to print messages to the
console.Configuration.messageLevel(int) is used.outStream - the new PrintStream for messages.messageLevel(int)void stringEncoding(StringEncoding encoding)
Db4oEmbedded.openFile(com.db4o.config.EmbeddedConfiguration, java.lang.String) or com.db4o.cs.Db4oClientServer#openServer.
config.stringEncoding(StringEncodings.utf8()));StringEncodingsvoid testConstructors(boolean flag)
false,
if all persistent classes have public default constructors.
trueflag - the desired settingvoid updateDepth(int depth)
ObjectContainer.store(java.lang.Object)
for further details.ObjectContainer.store(java.lang.Object)
will be updated.depth - the depth of the desired update.ObjectClass.updateDepth(int),
ObjectClass.cascadeOnUpdate(boolean),
Using callbacksvoid weakReferences(boolean flag)
ExtObjectContainer.purge(java.lang.Object)
false causes db4o to use hard
references to objects, preventing the garbage collection process
from disposing of unused objects.
true.void weakReferenceCollectionInterval(int milliseconds)
milliseconds - the time in millisecondsvoid registerTypeHandler(TypeHandlerPredicate predicate, TypeHandler4 typeHandler)
predicate - to specify for which classes and versions the
TypeHandler is to be used.typeHandler - to be used for the classes that match the predicate.EnvironmentConfiguration environment()
Environmentvoid nameProvider(NameProvider provider)
NameProvider that assigns a custom name to the database to be used in
Object.toString().void maxStackDepth(int maxStackDepth)
Sets the max stack depth that will be used for recursive storing and activating an object.
The default value is set to Const4.DEFAULT_MAX_STACK_DEPTH
On Android platform, we recomend setting this to 2.
depth - the desired max stack depth.int maxStackDepth()