org.jboss.verifier.event
Class EventGeneratorSupport

java.lang.Object
  extended by org.jboss.verifier.event.EventGeneratorSupport
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
VerificationEventGeneratorSupport

public abstract class EventGeneratorSupport
extends Object
implements Serializable, Cloneable

Support class for objects implementing the EventGenerator interface. Contains implementations for addListener, removeListener, and hasListeners.

Every effort has been made to try to achieve thread-safety in EventGeneratorSupport class. Of course, this doesn't mean nasty race conditions and dead locks don't exist. I'm just not aware of them :)

For more detailed documentation, refer to the Util Library Tutorial and Util Library Specifications . See Also: The Event Generator Idiom by Bill Venners.

Since:
JDK1.1
Version:
$Revision: 85945 $
Author:
Juha Lindfors
See Also:
org.gjt.lindfors.util.EventGenerator, Serialized Form

Constructor Summary
EventGeneratorSupport()
          Constructs support object.
 
Method Summary
protected  void addListener(EventListener listener)
          Registers a new listener to this object.
 Object clone()
          [PENDING]
protected  Enumeration getListeners()
          Returns the listeners registered to this object.
 boolean hasListeners()
          Checks if any registered listeners exist.
protected  void removeListener(EventListener listener)
          Unregisters a listener from this object.
 Component toComponent()
          [PENDING]
 String toString()
          Returns a string representation of this EventGeneratorSupport object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventGeneratorSupport

public EventGeneratorSupport()
Constructs support object.

Method Detail

hasListeners

public boolean hasListeners()
Checks if any registered listeners exist.

Returns:
true if one or more listeners exist, false otherwise

getListeners

protected Enumeration getListeners()
Returns the listeners registered to this object.

Returns:
enumeration of registered listener objects

addListener

protected void addListener(EventListener listener)
Registers a new listener to this object. Duplicate listeners are discarded.

This method is marked as protected and is supposed to be used only by the concrete implementations of generator support classes. The concrete subclasses must ensure only the correct type of listeners are allowed to register, as this method allows any listener to be added, therefore not being type safe.

Parameters:
listener - the listener object

removeListener

protected void removeListener(EventListener listener)
Unregisters a listener from this object. It is safe to attempt to unregister non-existant listeners.

Parameters:
listener - the listener object

toString

public String toString()
Returns a string representation of this EventGeneratorSupport object.

The output will be similar to the following form:

          EventGeneratorSupport[Registered Listeners=1]
 

Overrides:
toString in class Object

toComponent

public Component toComponent()
[PENDING]


clone

public Object clone()
[PENDING]

Overrides:
clone in class Object


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.