Registering for Event Notification

The methods used for registration of event notifications should conform to the standard design pattern for event-listener registration. The method signatures are:

public void add<ListenerType>(<ListenerType> listener);
public void remove<ListenerType>(<ListenerType> listener);

This pattern identifies the object that implements these methods as an event source for the event-listener interface of type <ListenerType>. The client object invokes the add<ListenerType>() method to register an interest in the events supported by the associated interface. When the client object is no longer interested in receiving these event notifications, it invokes the corresponding remove<ListenerType>() method.

Get Developing Java Beans now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.