Package com.privatejgoodies.common.bean

# Interface ObservableBean2

All Superinterfaces:
  `ObservableBean`

All Known Subinterfaces:
  `IActionBean`

All Known Implementing Classes:
  `AbstractUnitConverter`, `Bean`, `DefaultUnitConverter`

public interface ObservableBean2 extends ObservableBean
In addition to its super interface ObservableBean, this interface describes the optional support for registering PropertyChangeListeners for an individual property name. This interface is primarily intended to ensure compile-time safety for beans that shall be observed.

Author:
  Karsten Lentzsch
See Also:
  - `PropertyChangeListener`
  - `PropertyChangeEvent`
  - `PropertyChangeSupport`

## Method Summary

Modifier and Type
Method
Description
`void`
`addPropertyChangeListener(String propertyName, PropertyChangeListener listener)`
Adds a PropertyChangeListener to the listener list for a specific property.
`PropertyChangeListener[]`
`getPropertyChangeListeners()`
Returns an array of all the property change listeners registered on this component.
`PropertyChangeListener[]`
`getPropertyChangeListeners(String propertyName)`
Returns an array of all the listeners which have been associated with the named property.
`void`
`removePropertyChangeListener(String propertyName, PropertyChangeListener listener)`
Removes a PropertyChangeListener from the listener list for a specific property.

### Methods inherited from interface com.privatejgoodies.common.bean.ObservableBean

`addPropertyChangeListener, removePropertyChangeListener`

## Method Details

### addPropertyChangeListener

void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. The specified property may be user-defined.

Note that if this bean is inheriting a bound property, then no event will be fired in response to a change in the inherited property.

If listener is null, no exception is thrown and no action is performed.

Parameters:
  `propertyName` - one of the property names listed above
  `listener` - the PropertyChangeListener to be added
See Also:
  - `ObservableBean.removePropertyChangeListener(PropertyChangeListener)`
  - `removePropertyChangeListener(String, PropertyChangeListener)`
  - `ObservableBean.addPropertyChangeListener(PropertyChangeListener)`
  - `getPropertyChangeListeners(String)`

### removePropertyChangeListener

void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific bound property.

If listener is null, no exception is thrown and no action is performed.

Parameters:
  `propertyName` - a valid property name
  `listener` - the PropertyChangeListener to be removed
See Also:
  - `ObservableBean.addPropertyChangeListener(PropertyChangeListener)`
  - `addPropertyChangeListener(String, PropertyChangeListener)`
  - `ObservableBean.removePropertyChangeListener(PropertyChangeListener)`
  - `getPropertyChangeListeners(String)`

### getPropertyChangeListeners

PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component.

Returns:
  all of this component's `PropertyChangeListener`s or an empty array if no property change listeners are currently registered
See Also:
  - `ObservableBean.addPropertyChangeListener(PropertyChangeListener)`
  - `ObservableBean.removePropertyChangeListener(PropertyChangeListener)`
  - `getPropertyChangeListeners(String)`
  - `PropertyChangeSupport.getPropertyChangeListeners()`

### getPropertyChangeListeners

PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property.

Parameters:
  `propertyName` - the name of the property to lookup listeners
Returns:
  all of the `PropertyChangeListeners` associated with the named property or an empty array if no listeners have been added
See Also:
  - `addPropertyChangeListener(String, PropertyChangeListener)`
  - `removePropertyChangeListener(String, PropertyChangeListener)`
  - `getPropertyChangeListeners()`