| java.lang.Object com.sun.data.provider.impl.AbstractDataProvider com.sun.data.provider.impl.MapDataProvider
MapDataProvider | public class MapDataProvider extends AbstractDataProvider (Code) | | This
com.sun.data.provider.DataProvider wraps access to a standard
Map . This class can use regular
FieldKey objects as keys
(Map key will be the FieldKey's fieldId), or can use
MapFieldKey objects if a non-string key is desired.
NOTE about Serializable: By default, this class uses a
HashMap as its internal data storage, which is a Serializable implementation of
Map . The internal storage can be swapped out using the
setMap(Map) method. For this class to remain Serializable,
the contained Map must be a Serializable implementation. Also, and more
importantly, the contents of the storage Map must be Serializable as well
for this class to successfully be serialized.
author: Joe Nuxoll |
Inner Class :public class MapFieldKey extends FieldKey | |
Field Summary | |
protected Map | map |
Constructor Summary | |
public | MapDataProvider() Constructs a new MapDataProvider using a default
HashMap as the
internal storage. | public | MapDataProvider(Map map) Constructs a new MapDataProvider using the specified Map as the
internal storage.
NOTE about Serializable: By default, this class uses a
HashMap as its internal data storage, which is a Serializable implementation of
Map . |
MapDataProvider | public MapDataProvider()(Code) | | Constructs a new MapDataProvider using a default
HashMap as the
internal storage.
|
MapDataProvider | public MapDataProvider(Map map)(Code) | | Constructs a new MapDataProvider using the specified Map as the
internal storage.
NOTE about Serializable: By default, this class uses a
HashMap as its internal data storage, which is a Serializable implementation of
Map . The internal storage can be swapped out using the
setMap(Map) method. For this class to remain Serializable,
the contained Map must be a Serializable implementation. Also, and more
importantly, the contents of the storage Map must be Serializable as well
for this class to successfully be serialized.
Parameters: map - The Map to use as internal storage |
getFieldKey | public FieldKey getFieldKey(String fieldId) throws DataProviderException(Code) | | Returns a
FieldKey corresponding to the specified id.
Parameters: fieldId - The desired id to retrieve a FieldKey for FieldKey The FieldKey for the specified id (after completing arefresh) |
getMap | public Map getMap()(Code) | | Map being used as internal storage. |
getValue | public Object getValue(FieldKey fieldKey) throws DataProviderException(Code) | | Returns the value stored under the specified FieldKey in the Map. The
passed FieldKey may be a
FieldKey or a
MapFieldKey .
Parameters: fieldKey - The desired FieldKey to retieve the value for Object The object stored in the Map under the specified FieldKey |
isReadOnly | public boolean isReadOnly(FieldKey fieldKey) throws DataProviderException(Code) | | None of the Map entries are read-only, so this method always returns
false.
Parameters: fieldKey - The specified FieldKey (ignored) This method will always return false, as none of the Map entriesare read-only. |
refreshFieldKeys | protected void refreshFieldKeys()(Code) | | Refreshes the list of FieldKeys to reflect the current contents of the
Map. This is necessary because the storage Map could be manipulated at
any time by external means.
|
setMap | public void setMap(Map map)(Code) | | Sets the
Map to use as internal storage.
NOTE about Serializable: By default, this class uses a
HashMap as its internal data storage, which is a Serializable implementation of
Map . The internal storage can be swapped out using the
setMap(Map) method. For this class to remain Serializable,
the contained Map must be a Serializable implementation. Also, and more
importantly, the contents of the storage Map must be Serializable as well
for this class to successfully be serialized.
Parameters: map - Map to use as internal storage |
setValue | public void setValue(FieldKey fieldKey, Object value) throws DataProviderException(Code) | | Puts the specified value in the Map under the specified FieldKey. If the
passed FieldKey is a
MapFieldKey , the MapFieldKey.mapKey will be
used as the key, otherwise the FieldKey.id will be used as the key in the
underlying Map. This method will result in a valueChanged event being
fired to all
com.sun.data.provider.DataListener that are
listening to this DataProvider.
Parameters: fieldKey - The desired FieldKey to store the value under Parameters: value - The desired Object to store in the Map |
|
|