Class ConcurrentPropertySupport
java.lang.Object
VASSAL.property.ConcurrentPropertySupport
- All Implemented Interfaces:
PropertySupport
A thread-safe implementation of
PropertySupport.- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CopyOnWriteArrayList<PropertyListener<Object>> protected final ConcurrentMap<Property<?>, List<PropertyListener<?>>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidaddPropertyListener(Property<T> prop, PropertyListener<? super T> l) Adds a listener for a specificProperty.voidAdds a listener for all changes.<T> voidfireChanged(Object src, Property<T> prop, T oldVal, T newVal) Notifies listeners of a property change.Returns a list ofPropertyListeners listening to all changes.<T> List<PropertyListener<? super T>> getPropertyListeners(Property<T> prop) Returns a list ofPropertyListeners listening to a givenProperty.booleanChecks whether there arePropertyListeners for all changes.<T> booleanhasListeners(Property<T> prop) Checks whether there arePropertyListeners for a givenProperty.<T> voidremovePropertyListener(Property<T> prop, PropertyListener<? super T> l) Removes a listener for a specificProperty.voidRemoves a listener for all changes.
-
Field Details
-
listeners
-
plisteners
-
-
Constructor Details
-
ConcurrentPropertySupport
public ConcurrentPropertySupport()
-
-
Method Details
-
addPropertyListener
Adds a listener for all changes.- Specified by:
addPropertyListenerin interfacePropertySupport- Parameters:
l- the listener to add- Throws:
IllegalArgumentException- iflisnull
-
removePropertyListener
Removes a listener for all changes.- Specified by:
removePropertyListenerin interfacePropertySupport- Parameters:
l- the listener to remove- Throws:
IllegalArgumentException- iflisnull
-
hasListeners
public boolean hasListeners()Checks whether there arePropertyListeners for all changes.- Specified by:
hasListenersin interfacePropertySupport- Returns:
trueif there are listeners
-
getPropertyListeners
Returns a list ofPropertyListeners listening to all changes.- Specified by:
getPropertyListenersin interfacePropertySupport- Returns:
- a list of listeners
-
addPropertyListener
Adds a listener for a specificProperty.- Specified by:
addPropertyListenerin interfacePropertySupport- Parameters:
prop- thePropertyto listen onl- the listener to add
-
removePropertyListener
Removes a listener for a specificProperty.- Specified by:
removePropertyListenerin interfacePropertySupport- Parameters:
prop- thePropertylistened onl- the listener to remove
-
getPropertyListeners
Returns a list ofPropertyListeners listening to a givenProperty.- Specified by:
getPropertyListenersin interfacePropertySupport- Parameters:
prop- thePropertylistened on- Returns:
- a list of listeners
-
hasListeners
Checks whether there arePropertyListeners for a givenProperty.- Specified by:
hasListenersin interfacePropertySupport- Returns:
trueif there are listeners for the given property
-
fireChanged
Notifies listeners of a property change.- Specified by:
fireChangedin interfacePropertySupport- Parameters:
src- the source of the changeprop- the changedPropertyoldVal- the old value of thePropertynewVal- the new value of theProperty
-