public class AVListImpl extends java.lang.Object implements AVList
AVList
interface. Classes implementing AVList
can subclass or
aggregate this class to provide default AVList
functionality. This class maintains a hash table of
attribute-value pairs.
This class implements a notification mechanism for attribute-value changes. The mechanism provides a means for
objects to observe attribute changes or queries for certain keys without explicitly monitoring all keys. See PropertyChangeSupport
.Constructor and Description |
---|
AVListImpl()
Creates an empty attribute-value list.
|
AVListImpl(java.lang.Object sourceBean)
Constructor enabling aggregation
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the specified all-property property change listener that will be called for all list changes.
|
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Adds a property change listener for the specified key.
|
AVList |
clearList() |
AVList |
copy()
Returns a shallow copy of this
AVList instance: the keys and values themselves are not cloned. |
void |
firePropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Calls all registered property change listeners with the specified property change event.
|
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Calls all property change listeners associated with the specified key.
|
static java.lang.Boolean |
getBooleanValue(AVList avList,
java.lang.String key) |
static java.lang.Boolean |
getBooleanValue(AVList avList,
java.lang.String key,
java.lang.Boolean defaultValue) |
protected java.beans.PropertyChangeSupport |
getChangeSupport() |
static java.lang.Double |
getDoubleValue(AVList avList,
java.lang.String key) |
static java.lang.Double |
getDoubleValue(AVList avList,
java.lang.String key,
java.lang.Double defaultValue) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
getEntries() |
static java.lang.Integer |
getIntegerValue(AVList avList,
java.lang.String key) |
static java.lang.Integer |
getIntegerValue(AVList avList,
java.lang.String key,
java.lang.Integer defaultValue) |
static java.lang.Long |
getLongValue(AVList avList,
java.lang.String key) |
static java.lang.Long |
getLongValue(AVList avList,
java.lang.String key,
java.lang.Long defaultValue) |
void |
getRestorableStateForAVPair(java.lang.String key,
java.lang.Object value,
RestorableSupport rs,
RestorableSupport.StateObject context) |
static java.lang.String |
getStringValue(AVList avList,
java.lang.String key) |
static java.lang.String |
getStringValue(AVList avList,
java.lang.String key,
java.lang.String defaultValue) |
java.lang.String |
getStringValue(java.lang.String key)
Returns the value for a specified key.
|
java.lang.Object |
getValue(java.lang.String key)
Returns the value for a specified key.
|
java.util.Collection<java.lang.Object> |
getValues() |
boolean |
hasKey(java.lang.String key)
Indicates whether a key is in the collection.
|
java.lang.Object |
removeKey(java.lang.String key)
Removes a specified key from the collection if the key exists, otherwise returns without affecting the
collection.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the specified all-property property change listener.
|
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Removes a property change listener associated with the specified key.
|
java.lang.Object |
setValue(java.lang.String key,
java.lang.Object value)
Adds a key/value pair to the list.
|
AVList |
setValues(AVList list)
Adds the contents of another attribute-value list to the list.
|
public AVListImpl()
public AVListImpl(java.lang.Object sourceBean)
sourceBean
- The bean to be given as the source for any events.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
AVList
addPropertyChangeListener
in interface AVList
listener
- the listener to call.PropertyChangeSupport
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
AVList
addPropertyChangeListener
in interface AVList
propertyName
- the key to associate the listener with.listener
- the listener to associate with the key.PropertyChangeSupport
public AVList copy()
AVList
AVList
instance: the keys and values themselves are not cloned.public void firePropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
AVList
firePropertyChange
in interface AVList
propertyChangeEvent
- the eventPropertyChangeSupport
public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
AVList
odValue
and newValue
are equal and non-null.firePropertyChange
in interface AVList
propertyName
- the keyoldValue
- the value associated with the key before the even causing the firing.newValue
- the new value associated with the key.PropertyChangeSupport
public static java.lang.Boolean getBooleanValue(AVList avList, java.lang.String key)
public static java.lang.Boolean getBooleanValue(AVList avList, java.lang.String key, java.lang.Boolean defaultValue)
protected java.beans.PropertyChangeSupport getChangeSupport()
public static java.lang.Double getDoubleValue(AVList avList, java.lang.String key)
public static java.lang.Double getDoubleValue(AVList avList, java.lang.String key, java.lang.Double defaultValue)
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> getEntries()
getEntries
in interface AVList
public static java.lang.Integer getIntegerValue(AVList avList, java.lang.String key)
public static java.lang.Integer getIntegerValue(AVList avList, java.lang.String key, java.lang.Integer defaultValue)
public static java.lang.Long getLongValue(AVList avList, java.lang.String key)
public static java.lang.Long getLongValue(AVList avList, java.lang.String key, java.lang.Long defaultValue)
public void getRestorableStateForAVPair(java.lang.String key, java.lang.Object value, RestorableSupport rs, RestorableSupport.StateObject context)
public static java.lang.String getStringValue(AVList avList, java.lang.String key)
public static java.lang.String getStringValue(AVList avList, java.lang.String key, java.lang.String defaultValue)
public java.lang.String getStringValue(java.lang.String key)
AVList
String
.getStringValue
in interface AVList
key
- the attribute name. May not be null
.null
.public java.lang.Object getValue(java.lang.String key)
AVList
public java.util.Collection<java.lang.Object> getValues()
public boolean hasKey(java.lang.String key)
AVList
public java.lang.Object removeKey(java.lang.String key)
AVList
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
AVList
removePropertyChangeListener
in interface AVList
listener
- the listener to remove.PropertyChangeSupport
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
AVList
removePropertyChangeListener
in interface AVList
propertyName
- the key associated with the change listener.listener
- the listener to remove.PropertyChangeSupport
public java.lang.Object setValue(java.lang.String key, java.lang.Object value)
AVList
setValue
in interface AVList
key
- the attribute name. May not be null
.value
- the attribute value. May be null
, in which case any existing value for the key is
removed from the collection.