public class AVListImpl extends 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(Object sourceBean)
Constructor enabling aggregation
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds the specified all-property property change listener that will be called for all list changes.
|
void |
addPropertyChangeListener(String propertyName,
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(PropertyChangeEvent propertyChangeEvent)
Calls all registered property change listeners with the specified property change event.
|
void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Calls all property change listeners associated with the specified key.
|
static Boolean |
getBooleanValue(AVList avList,
String key) |
static Boolean |
getBooleanValue(AVList avList,
String key,
Boolean defaultValue) |
protected PropertyChangeSupport |
getChangeSupport() |
static Double |
getDoubleValue(AVList avList,
String key) |
static Double |
getDoubleValue(AVList avList,
String key,
Double defaultValue) |
Set<Map.Entry<String,Object>> |
getEntries() |
static Integer |
getIntegerValue(AVList avList,
String key) |
static Integer |
getIntegerValue(AVList avList,
String key,
Integer defaultValue) |
static Long |
getLongValue(AVList avList,
String key) |
static Long |
getLongValue(AVList avList,
String key,
Long defaultValue) |
void |
getRestorableStateForAVPair(String key,
Object value,
RestorableSupport rs,
RestorableSupport.StateObject context) |
static String |
getStringValue(AVList avList,
String key) |
static String |
getStringValue(AVList avList,
String key,
String defaultValue) |
String |
getStringValue(String key)
Returns the value for a specified key.
|
Object |
getValue(String key)
Returns the value for a specified key.
|
Collection<Object> |
getValues() |
boolean |
hasKey(String key)
Indicates whether a key is in the collection.
|
Object |
removeKey(String key)
Removes a specified key from the collection if the key exists, otherwise returns without affecting the
collection.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified all-property property change listener.
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a property change listener associated with the specified key.
|
Object |
setValue(String key,
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(Object sourceBean)
sourceBean - The bean to be given as the source for any events.public void addPropertyChangeListener(PropertyChangeListener listener)
AVListaddPropertyChangeListener in interface AVListlistener - the listener to call.PropertyChangeSupportpublic void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
AVListaddPropertyChangeListener in interface AVListpropertyName - the key to associate the listener with.listener - the listener to associate with the key.PropertyChangeSupportpublic AVList copy()
AVListAVList instance: the keys and values themselves are not cloned.public void firePropertyChange(PropertyChangeEvent propertyChangeEvent)
AVListfirePropertyChange in interface AVListpropertyChangeEvent - the eventPropertyChangeSupportpublic void firePropertyChange(String propertyName, Object oldValue, Object newValue)
AVListodValue and newValue are equal and non-null.firePropertyChange in interface AVListpropertyName - the keyoldValue - the value associated with the key before the even causing the firing.newValue - the new value associated with the key.PropertyChangeSupportpublic static Boolean getBooleanValue(AVList avList, String key, Boolean defaultValue)
protected PropertyChangeSupport getChangeSupport()
public Set<Map.Entry<String,Object>> getEntries()
getEntries in interface AVListpublic static Integer getIntegerValue(AVList avList, String key, Integer defaultValue)
public void getRestorableStateForAVPair(String key, Object value, RestorableSupport rs, RestorableSupport.StateObject context)
public String getStringValue(String key)
AVListString.getStringValue in interface AVListkey - the attribute name. May not be null.null.public Object getValue(String key)
AVListpublic Collection<Object> getValues()
public boolean hasKey(String key)
AVListpublic Object removeKey(String key)
AVListpublic void removePropertyChangeListener(PropertyChangeListener listener)
AVListremovePropertyChangeListener in interface AVListlistener - the listener to remove.PropertyChangeSupportpublic void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
AVListremovePropertyChangeListener in interface AVListpropertyName - the key associated with the change listener.listener - the listener to remove.PropertyChangeSupportpublic Object setValue(String key, Object value)
AVListsetValue in interface AVListkey - 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.