Top Description Fields Constructors Methods
java.beans

pack-priv abstract Class ChangeListenerMap<L extends EventListener>

extends Object
Class Inheritance
Known Direct Subclasses
java.beans.PropertyChangeSupport.PropertyChangeListenerMap, java.beans.VetoableChangeSupport.VetoableChangeListenerMap
Imports
java.util.ArrayList, .Collections, .EventListener, .EventListenerProxy, .HashMap, .List, .Map, .Map.Entry, .Set

This is an abstract class that provides base functionality for the PropertyChangeSupport class and the VetoableChangeSupport class.
Author
Sergey A. Malenkov
See Also
PropertyChangeSupport.PropertyChangeListenerMap, VetoableChangeSupport.VetoableChangeListenerMap

Field Summary

Modifier and TypeField and Description
private Map<String, L[]>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final synchronized void
add(String
the name of the property to listen on
name
,
L
the listener to process events
listener
)

Adds a listener to the list of listeners for the specified property.

public abstract L

Returns:

a real listener
extract
(L listener)

Extracts a real listener from the proxy listener.

public final synchronized L[]

Returns:

the corresponding list of listeners
get
(String
the name of the property
name
)

Returns the list of listeners for the specified property.

public final Set<Map.Entry<String, L[]>>

Returns:

a set of entries from the map
getEntries
()

Returns a set of entries from the map.

public final synchronized L[]

Returns:

an array of all listeners
getListeners
()

Returns all listeners in the map.

public final L[]

Returns:

an array of listeners for the named property
getListeners
(String
the name of the property
name
)

Returns listeners that have been associated with the named property.

public final synchronized boolean

Returns:

true if at least one listener exists or false otherwise
hasListeners
(String
the name of the property
name
)

Indicates whether the map contains at least one listener to be notified.

protected abstract L[]

Returns:

an array with specified length
newArray
(int
the array length
length
)

Creates an array of listeners.

protected abstract L

Returns:

a proxy listener
newProxy
(String
the name of the property to listen on
name
,
L
the listener to process events
listener
)

Creates a proxy listener for the specified property.

public final synchronized void
remove(String
the name of the property to listen on
name
,
L
the listener to process events
listener
)

Removes a listener from the list of listeners for the specified property.

public final void
set(String
the name of the property
name
,
L[]
new list of listeners
listeners
)

Sets new list of listeners for the specified property.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private Map<String, L[]> map

Constructor Detail

ChangeListenerMapback to summary
pack-priv ChangeListenerMap()

Method Detail

addback to summary
public final synchronized void add(String name, L listener)

Adds a listener to the list of listeners for the specified property. This listener is called as many times as it was added.

Parameters
name:String

the name of the property to listen on

listener:L

the listener to process events

extractback to summary
public abstract L extract(L listener)

Extracts a real listener from the proxy listener. It is necessary because default proxy class is not serializable.

Returns:L

a real listener

getback to summary
public final synchronized L[] get(String name)

Returns the list of listeners for the specified property.

Parameters
name:String

the name of the property

Returns:L[]

the corresponding list of listeners

getEntriesback to summary
public final Set<Map.Entry<String, L[]>> getEntries()

Returns a set of entries from the map. Each entry is a pair consisted of the property name and the corresponding list of listeners.

Returns:Set<Map.Entry<String, L[]>>

a set of entries from the map

getListenersback to summary
public final synchronized L[] getListeners()

Returns all listeners in the map.

Returns:L[]

an array of all listeners

getListenersback to summary
public final L[] getListeners(String name)

Returns listeners that have been associated with the named property.

Parameters
name:String

the name of the property

Returns:L[]

an array of listeners for the named property

hasListenersback to summary
public final synchronized boolean hasListeners(String name)

Indicates whether the map contains at least one listener to be notified.

Parameters
name:String

the name of the property

Returns:boolean

true if at least one listener exists or false otherwise

newArrayback to summary
protected abstract L[] newArray(int length)

Creates an array of listeners. This method can be optimized by using the same instance of the empty array when length is equal to 0.

Parameters
length:int

the array length

Returns:L[]

an array with specified length

newProxyback to summary
protected abstract L newProxy(String name, L listener)

Creates a proxy listener for the specified property.

Parameters
name:String

the name of the property to listen on

listener:L

the listener to process events

Returns:L

a proxy listener

removeback to summary
public final synchronized void remove(String name, L listener)

Removes a listener from the list of listeners for the specified property. If the listener was added more than once to the same event source, this listener will be notified one less time after being removed.

Parameters
name:String

the name of the property to listen on

listener:L

the listener to process events

setback to summary
public final void set(String name, L[] listeners)

Sets new list of listeners for the specified property.

Parameters
name:String

the name of the property

listeners:L[]

new list of listeners