java.lang.Object
jmri.beans.UnboundBean
jmri.beans.Bean
jmri.util.NamedBeanExpectedValue<T,S>
- Type Parameters:
T- the supported type of NamedBeanS- the supported type of value
- All Implemented Interfaces:
BeanInterface,PropertyChangeFirer,PropertyChangeProvider,ExpectedState<T,S>
- Direct Known Subclasses:
NamedBeanExpectedState
public class NamedBeanExpectedValue<T extends NamedBean,S>
extends Bean
implements ExpectedState<T,S>
Retain a NamedBean and its expected value (called a state in this class).
Note the NamedBean is held in a NamedBeanHandle.
-
Field Summary
Fields inherited from class jmri.beans.Bean
propertyChangeSupportFields inherited from interface jmri.ExpectedState
EXPECTED_STATE -
Constructor Summary
ConstructorsConstructorDescriptionNamedBeanExpectedValue(T bean, String name, S state) Create a NamedBeanExpectedValue, using the provided tracked name for the NamedBean.NamedBeanExpectedValue(T bean, S state) Create a NamedBeanExpectedValue, usingNamedBean.getDisplayName()to provide the tracked name for the NamedBean. -
Method Summary
Modifier and TypeMethodDescriptionGet the expected state.getName()Get the name of the contained NamedBean object.Get the Object this records the expected state for.voidsetExpectedState(S state) Set the expected state.Methods inherited from class jmri.beans.Bean
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, isNotifyOnEDT, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class jmri.beans.UnboundBean
getIndexedProperty, getProperty, getPropertyNames, hasIndexedProperty, hasProperty, setIndexedProperty, setProperty
-
Constructor Details
-
NamedBeanExpectedValue
Create a NamedBeanExpectedValue, using the provided tracked name for the NamedBean.- Parameters:
bean- the beanname- the namestate- the expected state
-
NamedBeanExpectedValue
Create a NamedBeanExpectedValue, usingNamedBean.getDisplayName()to provide the tracked name for the NamedBean.- Parameters:
bean- the beanstate- the expected state
-
-
Method Details
-
getExpectedState
Description copied from interface:ExpectedStateGet the expected state. This state should not change as the state of the NamedBean changes.- Specified by:
getExpectedStatein interfaceExpectedState<T extends NamedBean,S> - Returns:
- the expected state
-
setExpectedState
Description copied from interface:ExpectedStateSet the expected state.If UnsupportedOperationException is not thrown, this must fire a
PropertyChangeEventwith the name "expectedState"- Specified by:
setExpectedStatein interfaceExpectedState<T extends NamedBean,S> - Parameters:
state- the new expected state- Throws:
UnsupportedOperationException- if the implementing class does not allow states to be set
-
getObject
Description copied from interface:ExpectedStateGet the Object this records the expected state for.- Specified by:
getObjectin interfaceExpectedState<T extends NamedBean,S> - Returns:
- the associated object
-
getName
Get the name of the contained NamedBean object.- Returns:
- the name
-