Package gov.nasa.worldwind.avlist
Class AVListImpl
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- All Implemented Interfaces:
AVList
- Direct Known Subclasses:
AbstractAnnotation,AbstractBrowserBalloon.BrowserControl,AbstractDataRaster,AbstractDataRasterReader,AbstractDataStoreProducer.SourceInfo,AbstractFileStore.StoreLocation,AbstractHotSpot,AbstractTacticalGraphic,BasicNetworkStatus,BasicXMLEventParserContext,CachedDataRaster,DataInstaller,FileSet,FileSetPreviewImageGenerator,FileStoreDataSet,Geometry,GliderImage,GliderRegionOfInterest,GraticuleRenderingParams,LazilyLoadedTexture,Level,LineBuilder,MeasureTool,MilStd2525PointGraphic,PickedObject,RasterControlPointList.ControlPoint,ScreenSizeDetailLevel,ShapeDataCache.ShapeDataCacheEntry,SymbolCode,UnitsFormat,UserFacingIcon,WWObjectImpl,WWOMeasureTool
public class AVListImpl extends java.lang.Object implements AVList
An implementation class for theAVListinterface. Classes implementingAVListcan subclass or aggregate this class to provide defaultAVListfunctionality. 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 Summary
Constructors Constructor Description AVListImpl()Creates an empty attribute-value list.AVListImpl(java.lang.Object sourceBean)Constructor enabling aggregation
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Adds the specified all-property property change listener that will be called for all list changes.voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Adds a property change listener for the specified key.AVListclearList()AVListcopy()Returns a shallow copy of thisAVListinstance: the keys and values themselves are not cloned.voidfirePropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)Calls all registered property change listeners with the specified property change event.voidfirePropertyChange(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.BooleangetBooleanValue(AVList avList, java.lang.String key)static java.lang.BooleangetBooleanValue(AVList avList, java.lang.String key, java.lang.Boolean defaultValue)protected java.beans.PropertyChangeSupportgetChangeSupport()static java.lang.DoublegetDoubleValue(AVList avList, java.lang.String key)static java.lang.DoublegetDoubleValue(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.IntegergetIntegerValue(AVList avList, java.lang.String key)static java.lang.IntegergetIntegerValue(AVList avList, java.lang.String key, java.lang.Integer defaultValue)static java.lang.LonggetLongValue(AVList avList, java.lang.String key)static java.lang.LonggetLongValue(AVList avList, java.lang.String key, java.lang.Long defaultValue)voidgetRestorableStateForAVPair(java.lang.String key, java.lang.Object value, RestorableSupport rs, RestorableSupport.StateObject context)static java.lang.StringgetStringValue(AVList avList, java.lang.String key)static java.lang.StringgetStringValue(AVList avList, java.lang.String key, java.lang.String defaultValue)java.lang.StringgetStringValue(java.lang.String key)Returns the value for a specified key.java.lang.ObjectgetValue(java.lang.String key)Returns the value for a specified key.java.util.Collection<java.lang.Object>getValues()booleanhasKey(java.lang.String key)Indicates whether a key is in the collection.java.lang.ObjectremoveKey(java.lang.String key)Removes a specified key from the collection if the key exists, otherwise returns without affecting the collection.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Removes the specified all-property property change listener.voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Removes a property change listener associated with the specified key.java.lang.ObjectsetValue(java.lang.String key, java.lang.Object value)Adds a key/value pair to the list.AVListsetValues(AVList list)Adds the contents of another attribute-value list to the list.
-
-
-
Method Detail
-
getValue
public java.lang.Object getValue(java.lang.String key)
Description copied from interface:AVListReturns the value for a specified key.
-
getValues
public java.util.Collection<java.lang.Object> getValues()
-
getEntries
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> getEntries()
- Specified by:
getEntriesin interfaceAVList
-
getStringValue
public java.lang.String getStringValue(java.lang.String key)
Description copied from interface:AVListReturns the value for a specified key. The value must be aString.- Specified by:
getStringValuein interfaceAVList- Parameters:
key- the attribute name. May not benull.- Returns:
- the attribute value if one exists in the collection, otherwise
null.
-
setValue
public java.lang.Object setValue(java.lang.String key, java.lang.Object value)Description copied from interface:AVListAdds a key/value pair to the list. Replaces an existing key/value pair if the list already contains the key.- Specified by:
setValuein interfaceAVList- Parameters:
key- the attribute name. May not benull.value- the attribute value. May benull, in which case any existing value for the key is removed from the collection.- Returns:
- previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.
-
setValues
public AVList setValues(AVList list)
Description copied from interface:AVListAdds the contents of another attribute-value list to the list. Replaces an existing key/value pair if the list already contains the key.
-
hasKey
public boolean hasKey(java.lang.String key)
Description copied from interface:AVListIndicates whether a key is in the collection.
-
removeKey
public java.lang.Object removeKey(java.lang.String key)
Description copied from interface:AVListRemoves a specified key from the collection if the key exists, otherwise returns without affecting the collection.
-
copy
public AVList copy()
Description copied from interface:AVListReturns a shallow copy of thisAVListinstance: the keys and values themselves are not cloned.
-
getChangeSupport
protected java.beans.PropertyChangeSupport getChangeSupport()
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:AVListAdds a property change listener for the specified key.- Specified by:
addPropertyChangeListenerin interfaceAVList- Parameters:
propertyName- the key to associate the listener with.listener- the listener to associate with the key.- See Also:
PropertyChangeSupport
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:AVListRemoves a property change listener associated with the specified key.- Specified by:
removePropertyChangeListenerin interfaceAVList- Parameters:
propertyName- the key associated with the change listener.listener- the listener to remove.- See Also:
PropertyChangeSupport
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:AVListAdds the specified all-property property change listener that will be called for all list changes.- Specified by:
addPropertyChangeListenerin interfaceAVList- Parameters:
listener- the listener to call.- See Also:
PropertyChangeSupport
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:AVListRemoves the specified all-property property change listener.- Specified by:
removePropertyChangeListenerin interfaceAVList- Parameters:
listener- the listener to remove.- See Also:
PropertyChangeSupport
-
firePropertyChange
public void firePropertyChange(java.beans.PropertyChangeEvent propertyChangeEvent)
Description copied from interface:AVListCalls all registered property change listeners with the specified property change event.- Specified by:
firePropertyChangein interfaceAVList- Parameters:
propertyChangeEvent- the event- See Also:
PropertyChangeSupport
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)Description copied from interface:AVListCalls all property change listeners associated with the specified key. No listeners are called ifodValueandnewValueare equal and non-null.- Specified by:
firePropertyChangein interfaceAVList- Parameters:
propertyName- the keyoldValue- the value associated with the key before the even causing the firing.newValue- the new value associated with the key.- See Also:
PropertyChangeSupport
-
getStringValue
public static java.lang.String getStringValue(AVList avList, java.lang.String key, java.lang.String defaultValue)
-
getStringValue
public static java.lang.String getStringValue(AVList avList, java.lang.String key)
-
getIntegerValue
public static java.lang.Integer getIntegerValue(AVList avList, java.lang.String key, java.lang.Integer defaultValue)
-
getIntegerValue
public static java.lang.Integer getIntegerValue(AVList avList, java.lang.String key)
-
getLongValue
public static java.lang.Long getLongValue(AVList avList, java.lang.String key, java.lang.Long defaultValue)
-
getLongValue
public static java.lang.Long getLongValue(AVList avList, java.lang.String key)
-
getDoubleValue
public static java.lang.Double getDoubleValue(AVList avList, java.lang.String key, java.lang.Double defaultValue)
-
getDoubleValue
public static java.lang.Double getDoubleValue(AVList avList, java.lang.String key)
-
getRestorableStateForAVPair
public void getRestorableStateForAVPair(java.lang.String key, java.lang.Object value, RestorableSupport rs, RestorableSupport.StateObject context)
-
getBooleanValue
public static java.lang.Boolean getBooleanValue(AVList avList, java.lang.String key, java.lang.Boolean defaultValue)
-
getBooleanValue
public static java.lang.Boolean getBooleanValue(AVList avList, java.lang.String key)
-
-