Chapter 5. Advanced Features

Table of Contents

Collection Properties
Topic Merging
Dynamic Merging
Static Merging
Setting the Merging Mode
MergedTopicSubjectClashException
Implicit Topics
Property Change Listeners
Multi-value Property Changes
Vetoable Changes
Default Listeners
Overriding The Default Listeners
Turning Off Event Notification
Advanced Topic Map Parsing Using TopicMapBuilder
Configuring Parsing
Creating a Customised TopicMapSource

Collection Properties

All multi-valued properties follow a specific pattern of accessors. There is always a getXXX() method which returns a collection; a setXXX() method which takes an array of the type of value to be assigned to the property; and an addXXX() function which takes a single instance of the type of value to be assigned to the property. The setXXX() function may be invoked with a null parameter causes the property value to be cleared.

The TM4J API guarantees to never return a null value for the getXXX() accessor of a multi-valued property - if the object has no values at all for that property, an empty Collection is returned. This means that code such as the following will execute correctly:

Iterator typesIt = topic.getTypes().iterator();

Note

This guaruntee of no null return values does not apply to properties which only have a single value - in those cases, the null return value indicates that the property is not set for that object.