2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
7 package gov
.nasa
.worldwind
.avlist
;
12 * An interface for managing an attribute-value pair collection.
15 * @version $Id: AVList.java 2422 2007-07-25 23:07:49Z tgaskins $
17 public interface AVList
20 * Adds a key/value pair to the list. Replaces an existing key/value pair if the list already contains the key.
22 * @param key the attribute name. May not be <code>null</code>.
23 * @param value the attribute value. May be <code>null</code>, in which case any existing value for the key is
24 * removed from the collection.
25 * @throws NullPointerException if <code>key</code> is <code>null</code>.
27 void setValue(String key
, Object value
);
29 void setValues(AVList avList
);
32 * Returns the value for a specified key.
34 * @param key the attribute name. May not be <code>null</code>.
35 * @return the attribute value if one exists in the collection, otherwise <code>null</code>.
36 * @throws NullPointerException if <code>key</code> is <code>null</code>.
38 Object
getValue(String key
);
40 Collection
<Object
> getValues();
43 * Returns the value for a specified key. The value must be a {@link String}.
45 * @param key the attribute name. May not be <code>null</code>.
46 * @return the attribute value if one exists in the collection, otherwise <code>null</code>.
47 * @throws NullPointerException if <code>key</code> is <code>null</code>.
48 * @throws gov.nasa.worldwind.exception.WWRuntimeException if the value in the collection is not a <code>String</code> type.
50 String
getStringValue(String key
);
52 Set
<Map
.Entry
<String
, Object
>> getEntries();
55 * Indicates whether a key is in the collection.
57 * @param key the attribute name. May not be <code>null</code>.
58 * @return <code>true</code> if the key exists in the collection, otherwise <code>false</code>.
59 * @throws NullPointerException if <code>key</code> is <code>null</code>.
61 boolean hasKey(String key
);
64 * Removes a specified key from the collection if the key exists, otherwise returns without affecting the
67 * @param key the attribute name. May not be <code>null</code>.
68 * @throws NullPointerException if <code>key</code> is <code>null</code>.
70 void removeKey(String key
);
73 * Adds a property change listener for the specified key.
74 * @param propertyName the key to associate the listener with.
75 * @param listener the listener to associate with the key.
76 * @throws IllegalArgumentException if either <code>propertyName</code> or <code>listener</code> is null
77 * @see java.beans.PropertyChangeSupport
79 void addPropertyChangeListener(String propertyName
, java
.beans
.PropertyChangeListener listener
);
82 * Removes a property change listener associated with the specified key.
83 * @param propertyName the key associated with the change listener.
84 * @param listener the listener to remove.
85 * @throws IllegalArgumentException if either <code>propertyName</code> or <code>listener</code> is null
86 * @see java.beans.PropertyChangeSupport
88 void removePropertyChangeListener(String propertyName
, java
.beans
.PropertyChangeListener listener
);
91 * Adds the specified all-property property change listener that will be called for all list changes.
92 * @param listener the listener to call.
93 * @throws IllegalArgumentException if <code>listener</code> is null
94 * @see java.beans.PropertyChangeSupport
96 void addPropertyChangeListener(java
.beans
.PropertyChangeListener listener
);
99 * Removes the specified all-property property change listener.
100 * @param listener the listener to remove.
101 * @throws IllegalArgumentException if <code>listener</code> is null
102 * @see java.beans.PropertyChangeSupport
104 void removePropertyChangeListener(java
.beans
.PropertyChangeListener listener
);
107 * Calls all property change listeners associated with the specified key.
108 * No listeners are called if <code>odValue</code> and <code>newValue</code> are equal and non-null.
109 * @param propertyName the key
110 * @param oldValue the value associated with the key before the even causing the firing.
111 * @param newValue the new value associated with the key.
112 * @throws IllegalArgumentException if <code>propertyName</code> is null
113 * @see java.beans.PropertyChangeSupport
115 void firePropertyChange(String propertyName
, Object oldValue
, Object newValue
);
118 * Calls all registered property change listeners with the specified property change event.
119 * @param propertyChangeEvent the event
120 * @throws IllegalArgumentException if <code>propertyChangeEvent</code> is null
121 * @see java.beans.PropertyChangeSupport
123 void firePropertyChange(java
.beans
.PropertyChangeEvent propertyChangeEvent
);
126 * Returns a shallow copy of this <code>AVList</code> instance: the keys and values themselves are not cloned.
127 * @return a shallow copy of this <code>AVList</code>.