Package VASSAL.property
Class SinglePropertyContainer<V>
java.lang.Object
VASSAL.property.SinglePropertyContainer<V>
- Type Parameters:
V- the class of the value of the containedProperty
- All Implemented Interfaces:
PropertyContainer
A
PropertyContainer which holds one Property.
This class is intended for testing purposes only. It will not
generally be useful to have a dedicated container which holds only
one Property.- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CopyOnWriteArrayList<PropertyListener<Object>>protected final CopyOnWriteArrayList<PropertyListener<? super V>>protected V -
Constructor Summary
ConstructorsConstructorDescriptionSinglePropertyContainer(Property<V> prop, V value) Creates a container for a singleProperty. -
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 to this container.Returns thePropertys known to this container.Returns a list ofPropertyListeners listening to all changes to this container.<T> List<PropertyListener<? super T>>getPropertyListeners(Property<T> prop) Returns a list ofPropertyListeners listening to a givenProperty.<T> TGets the value of aProperty.booleanChecks whether there arePropertyListeners for all changes to this container.<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 to this container.<T> voidSets the value of aProperty.
-
Field Details
-
prop
-
value
-
listeners
-
plisteners
-
-
Constructor Details
-
SinglePropertyContainer
Creates a container for a singleProperty.- Parameters:
prop- the propertyvalue- the initial value of the property- Throws:
IllegalArgumentException- ifproporvalueisnull
-
-
Method Details
-
getProperties
Returns thePropertys known to this container.- Specified by:
getPropertiesin interfacePropertyContainer- Returns:
- a set of known
Propertys
-
setValue
Sets the value of aProperty.- Specified by:
setValuein interfacePropertyContainer- Parameters:
prop- thePropertyvalue- the value
-
getValue
Gets the value of aProperty.- Specified by:
getValuein interfacePropertyContainer- Parameters:
prop- theProperty- Returns:
- the value
-
addPropertyListener
Adds a listener for all changes to this container.- Specified by:
addPropertyListenerin interfacePropertyContainer- Parameters:
l- the listener to add
-
addPropertyListener
Adds a listener for a specificProperty.- Specified by:
addPropertyListenerin interfacePropertyContainer- Parameters:
prop- thePropertyto listen onl- the listener to add
-
removePropertyListener
Removes a listener for all changes to this container.- Specified by:
removePropertyListenerin interfacePropertyContainer- Parameters:
l- the listener to remove
-
removePropertyListener
Removes a listener for a specificProperty.- Specified by:
removePropertyListenerin interfacePropertyContainer- Parameters:
prop- thePropertylistened onl- the listener to remove
-
getPropertyListeners
Returns a list ofPropertyListeners listening to all changes to this container.- Specified by:
getPropertyListenersin interfacePropertyContainer- Returns:
- a list of listeners
-
getPropertyListeners
Returns a list ofPropertyListeners listening to a givenProperty.- Specified by:
getPropertyListenersin interfacePropertyContainer- Parameters:
prop- thePropertylistened on- Returns:
- a list of listeners
-
hasListeners
public boolean hasListeners()Checks whether there arePropertyListeners for all changes to this container.- Specified by:
hasListenersin interfacePropertyContainer- Returns:
trueif there are listeners
-
hasListeners
Checks whether there arePropertyListeners for a givenProperty.- Specified by:
hasListenersin interfacePropertyContainer- Returns:
trueif there are listeners for the given property
-