Package com.db4o.constraints
Class UniqueFieldValueConstraint
- java.lang.Object
-
- com.db4o.constraints.UniqueFieldValueConstraint
-
- All Implemented Interfaces:
ConfigurationItem
public class UniqueFieldValueConstraint extends java.lang.Object implements ConfigurationItem
Configures a field of a class to allow unique values only. In C/S mode, add this configuration-item to the server side only. You need to turn on indexing for the given field, otherwise the unique constrain won't work. Add this to your configuration withCommonConfiguration.add(com.db4o.config.ConfigurationItem)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Object
_clazz
protected java.lang.String
_fieldName
-
Constructor Summary
Constructors Constructor Description UniqueFieldValueConstraint(java.lang.Object clazz, java.lang.String fieldName)
constructor to create a UniqueFieldValueConstraint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(InternalObjectContainer objectContainer)
internal method, public for implementation reasons.void
prepare(Configuration configuration)
Gives a chance for the item to augment the configuration.
-
-
-
Constructor Detail
-
UniqueFieldValueConstraint
public UniqueFieldValueConstraint(java.lang.Object clazz, java.lang.String fieldName)
constructor to create a UniqueFieldValueConstraint.- Parameters:
clazz
- can be a class (Java) / Type (.NET) / instance of the class / fully qualified class namefieldName
- the name of the field that is to be unique.
-
-
Method Detail
-
prepare
public void prepare(Configuration configuration)
Description copied from interface:ConfigurationItem
Gives a chance for the item to augment the configuration.- Specified by:
prepare
in interfaceConfigurationItem
- Parameters:
configuration
- the configuration that the item was added to
-
apply
public void apply(InternalObjectContainer objectContainer)
internal method, public for implementation reasons.- Specified by:
apply
in interfaceConfigurationItem
- Parameters:
objectContainer
- the ObjectContainer to configure
-
-