public class CommonConfigurationImpl extends java.lang.Object implements CommonConfiguration
| Constructor and Description |
|---|
CommonConfigurationImpl(Config4Impl config) |
| 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 |
callbackMode(CallBackMode mode) |
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
CommonConfiguration.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.
|
public CommonConfigurationImpl(Config4Impl config)
public void activationDepth(int depth)
CommonConfigurationObjectSet 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.activationDepth in interface CommonConfigurationdepth - the desired global activation depth.configuring classes individuallypublic int activationDepth()
CommonConfigurationactivationDepth in interface CommonConfigurationpublic void add(ConfigurationItem configurationItem)
CommonConfigurationadd in interface CommonConfigurationconfigurationItem - the ConfigurationItempublic void addAlias(Alias alias)
CommonConfigurationTypeAlias 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*"));
addAlias in interface CommonConfigurationpublic void removeAlias(Alias alias)
CommonConfigurationCommonConfiguration.addAlias(Alias).removeAlias in interface CommonConfigurationalias - the alias to removepublic void allowVersionUpdates(boolean flag)
CommonConfigurationallowVersionUpdates in interface CommonConfigurationpublic void automaticShutDown(boolean flag)
CommonConfigurationtrue.automaticShutDown in interface CommonConfigurationflag - whether db4o should shut down automatically.public void bTreeNodeSize(int size)
CommonConfigurationbTreeNodeSize in interface CommonConfigurationsize - the number of elements held in one BTree node.public void callbacks(boolean flag)
CommonConfigurationcallbacks in interface CommonConfigurationflag - false to turn callback methods offUsing callbackspublic void callbackMode(CallBackMode mode)
public void callConstructors(boolean flag)
CommonConfigurationObjectClass.callConstructor(boolean).
callConstructors in interface CommonConfigurationflag - - specify true, to request calling constructors, specify
false to request not calling constructors.ObjectClass.callConstructor(boolean)public void detectSchemaChanges(boolean flag)
CommonConfigurationtruedetectSchemaChanges in interface CommonConfigurationflag - the desired settingpublic DiagnosticConfiguration diagnostic()
CommonConfigurationdiagnostic in interface CommonConfigurationpublic void exceptionsOnNotStorable(boolean flag)
CommonConfigurationObjectNotStorableException
if an object can not be stored.
exceptionsOnNotStorable in interface CommonConfigurationflag - true to throw Exceptions if objects can not be stored.public void internStrings(boolean flag)
CommonConfigurationinternStrings in interface CommonConfigurationflag - true to intern stringspublic void markTransient(java.lang.String attributeName)
CommonConfigurationmarkTransient in interface CommonConfigurationattributeName - - the fully qualified name of the attribute, including
it's namespacepublic void messageLevel(int level)
CommonConfigurationPrintStream.
messageLevel in interface CommonConfigurationlevel - integer from 0 to 3TODO: replace int with enumerationpublic ObjectClass objectClass(java.lang.Object clazz)
CommonConfigurationObjectClass object
to configure the specified class.
objectClass in interface CommonConfigurationclazz - class name, Class object, or example object.ObjectClass
object for configuration.public void optimizeNativeQueries(boolean optimizeNQ)
CommonConfigurationtrue.optimizeNativeQueries in interface CommonConfigurationoptimizeNQ - true, if db4o should try to optimize
native queries at query execution time, false otherwisepublic boolean optimizeNativeQueries()
CommonConfigurationoptimizeNativeQueries in interface CommonConfigurationCommonConfiguration.optimizeNativeQueries(boolean)public QueryConfiguration queries()
CommonConfigurationqueries in interface CommonConfigurationpublic void reflectWith(Reflector reflector)
CommonConfigurationreflectWith in interface CommonConfigurationpublic void outStream(java.io.PrintStream outStream)
CommonConfigurationPrintStream 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 in interface CommonConfigurationoutStream - the new PrintStream for messages.CommonConfiguration.messageLevel(int)public void stringEncoding(StringEncoding encoding)
CommonConfigurationDb4oEmbedded.openFile(com.db4o.config.EmbeddedConfiguration, java.lang.String) or com.db4o.cs.Db4oClientServer#openServer.
config.stringEncoding(StringEncodings.utf8()));stringEncoding in interface CommonConfigurationStringEncodingspublic void testConstructors(boolean flag)
CommonConfigurationfalse,
if all persistent classes have public default constructors.
truetestConstructors in interface CommonConfigurationflag - the desired settingpublic void updateDepth(int depth)
CommonConfigurationObjectContainer.store(java.lang.Object)
for further details.ObjectContainer.store(java.lang.Object)
will be updated.updateDepth in interface CommonConfigurationdepth - the depth of the desired update.ObjectClass.updateDepth(int),
ObjectClass.cascadeOnUpdate(boolean),
Using callbackspublic void weakReferences(boolean flag)
CommonConfigurationExtObjectContainer.purge(java.lang.Object)
false causes db4o to use hard
references to objects, preventing the garbage collection process
from disposing of unused objects.
true.weakReferences in interface CommonConfigurationpublic void weakReferenceCollectionInterval(int milliseconds)
CommonConfigurationweakReferenceCollectionInterval in interface CommonConfigurationmilliseconds - the time in millisecondspublic void registerTypeHandler(TypeHandlerPredicate predicate, TypeHandler4 typeHandler)
CommonConfigurationregisterTypeHandler in interface CommonConfigurationpredicate - to specify for which classes and versions the
TypeHandler is to be used.typeHandler - to be used for the classes that match the predicate.public EnvironmentConfiguration environment()
environment in interface CommonConfigurationEnvironmentpublic void nameProvider(NameProvider provider)
CommonConfigurationNameProvider that assigns a custom name to the database to be used in
Object.toString().nameProvider in interface CommonConfigurationpublic void maxStackDepth(int maxStackDepth)
CommonConfigurationSets 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.
maxStackDepth in interface CommonConfigurationpublic int maxStackDepth()
CommonConfigurationmaxStackDepth in interface CommonConfiguration