Class Config4Class

    • 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 in CommonConfiguration.callConstructors(boolean).

        In client-server environment this setting should be used on both client and server.

        Specified by:
        callConstructor in interface ObjectClass
        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 interface ObjectClass
        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.
        Specified by:
        deepClone in interface DeepClone
      • 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 interface ObjectClass
      • 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 interface ObjectClass
      • 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 interface ObjectClass
      • 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 interface ObjectClass
      • 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 the global 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 interface ObjectClass
        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 the global 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 interface ObjectClass
        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 interface ObjectClass
        Returns:
        the configured minimum activation depth.
      • callConstructor

        public TernaryBool callConstructor()
      • objectField

        public ObjectField objectField​(java.lang.String fieldName)
        Description copied from interface: ObjectClass
        returns an ObjectField object to configure the specified field.

        Specified by:
        objectField in interface ObjectClass
        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 interface ObjectClass
      • 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 interface ObjectClass
        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 interface ObjectClass
        Parameters:
        flag - whether or not transient fields are to be stored.
      • storeTransientFields

        public boolean storeTransientFields()