Multi-value Property Changes

In addition to supporting the standard Java property change notification interfaces, TM4J uses a separate interface for notifying changes to potentially large collections. This interface is the org.tm4j.utils.MultiValuePropertyChangeListener interface. The interface supports only a single notification method multiValuePropertyChange() which receives a single paramter of the type org.tm4j.utils.MultiValuePropertyChangeEvent. Unlike a standard java.beans.PropertyChangeEvent, the MultiValuePropertyChangeEvent class describes the change to a collection as a combination of an operation and an operand. The different operations that can be notified are listed in the table below. The type of the operand depends upon a combination of the operation performed and the property that was modified.

Table 5.2. MultiValuePropertyChangeEvent operation types

Operation ConstantNotified WhenOperand
OP_ADD_SINGLEA single object has been added to the collection property.The object that was added to the collection property.
OP_ADD_SETA collection of objects has been added to the collection property.The collection of objects added.
OP_REMOVE_SINGLEA single object has been removed from the collection property.The object that has been removed.
OP_REMOVE_SETA collection of objects have been removed from the collection property.The collection of objects removed.

The following table shows which property changes are notified through this mechanism, and what the object type of the property is. In the case of OP_ADD_SINGLE and OP_REMOVE_SINGLE, the operand will be an object of the specified object type. In the case of OP_ADD_SET and OP_REMOVE_SET, the operand will always be a java.util.Collection containing objects of the specified object type.

Table 5.3. Property Changes Notified Through The MultiValuePropertyChangeListener Interface

Source Object TypeProperty NameProperty Object Type
TopicMaptopicsTopic
TopicMapassociationsAssociation
TopicoccurrencesOccurrence
TopictypesTopic