public abstract class UserPropertyInitializer extends PropertyInitializer
PropertyInitializer.
Subclasses of UserPropertyInitializer can be used for two separate, although
similar purposes depending on where they are registered.
Property Initialization
To provide initial values of User Properties whenever a new DBObject
is created, register in the offline-database-hook as follows:
<offline-database-hook xmlns="http://xmlns.oracle.com/ide/extension/db"> <property-initializers> <initializer-class>MyPropertyInitializer</initializer-class> </property-initializers> </offline-database-hook>NB. Changes to the implementation of the Property Initializer will have no impact on pre-existing objects.
Dynamic Defaults
To provide a dynamic default value for a User Property when the stored value
is null, register in the offline-database-user-properties-hook as follows:
<offline-database-user-properties-hook xmlns="http://xmlns.oracle.com/ide/extension/db"> <user-property-default-value-providers> <default-value-provider-class>MyPropertyInitializer</default-value-provider-class> </user-property-default-value-providers> </offline-database-user-properties-hook>NB. Changes to the implementation of a dynamic default provider impact all objects, new or pre-existing, if the value of the User Property defined against them is null.
PropertyInitializer.InitializationVeto| Modifier | Constructor and Description |
|---|---|
protected |
UserPropertyInitializer(DBObjectProvider pro)
NB subclasses must provide a constructor that takes a DBObjectProvider
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getPropertyInitialValue(DBObject obj,
java.lang.String propertyName) |
java.lang.String[] |
getPropertyNames(java.lang.Class<? extends DBObject> clz) |
protected abstract java.lang.String |
getUserPropertyDefault(DBObject obj,
java.lang.String userPropertyName)
Concrete subclasses should return the default value of the user property
with the given name for the given DBObject or throw a
PropertyInitializer.InitializationVeto exception.
|
protected abstract java.lang.String[] |
getUserPropertyNames(java.lang.Class<? extends DBObject> clz)
Concrete subclasses should return a String[] of user property names for
objects of the given class for which they provide a default value.
|
getProviderprotected UserPropertyInitializer(DBObjectProvider pro)
public final java.lang.String[] getPropertyNames(java.lang.Class<? extends DBObject> clz)
getPropertyNames in class PropertyInitializerclz - the class of object for which supported properties are being requested.public final java.lang.Object getPropertyInitialValue(DBObject obj, java.lang.String propertyName) throws PropertyInitializer.InitializationVeto
getPropertyInitialValue in class PropertyInitializerPropertyInitializer.InitializationVetoprotected abstract java.lang.String[] getUserPropertyNames(java.lang.Class<? extends DBObject> clz)
protected abstract java.lang.String getUserPropertyDefault(DBObject obj, java.lang.String userPropertyName) throws PropertyInitializer.InitializationVeto