|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.bdb.collection.StoredContainer
com.sleepycat.bdb.collection.StoredMap
public class StoredMap
A Map view of a DataStore
or DataIndex
.
In addition to the standard Map methods, this class provides the following methods for stored maps only. Note that the use of these methods is not compatible with the standard Java collections interface.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
StoredMap(DataIndex index,
DataBinding keyBinding,
DataBinding valueBinding,
boolean writeAllowed)
Creates a map view of a DataIndex . |
|
StoredMap(DataIndex index,
DataBinding keyBinding,
EntityBinding valueEntityBinding,
boolean writeAllowed)
Creates a map entity view of a DataIndex . |
|
StoredMap(DataStore store,
DataBinding keyBinding,
DataBinding valueBinding,
boolean writeAllowed)
Creates a map view of a DataStore . |
|
StoredMap(DataStore store,
DataBinding keyBinding,
EntityBinding valueEntityBinding,
boolean writeAllowed)
Creates a map entity view of a DataStore . |
Method Summary | |
---|---|
java.lang.Object |
append(java.lang.Object value)
Appends a given value returning the newly assigned key. |
protected java.lang.Object |
clone()
|
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains the specified key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this map contains the specified value. |
java.util.Collection |
duplicates(java.lang.Object key)
Returns a new collection containing the values mapped to the given key in this map. |
java.util.Set |
entrySet()
Returns a set view of the mappings contained in this map. |
boolean |
equals(java.lang.Object other)
Compares the specified object with this map for equality. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which this map maps the specified key. |
java.util.Set |
keySet()
Returns a set view of the keys contained in this map. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified value with the specified key in this map (optional operation). |
void |
putAll(java.util.Map map)
Copies all of the mappings from the specified map to this map (optional operation). |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for this key from this map if present (optional operation). |
java.lang.String |
toString()
Converts the map to a string representation for debugging. |
java.util.Collection |
values()
Returns a collection view of the values contained in this map. |
Methods inherited from class com.sleepycat.bdb.collection.StoredContainer |
---|
areDuplicatesAllowed, areDuplicatesOrdered, areKeysRenumbered, clear, isAutoCommit, isDirtyReadAllowed, isDirtyReadEnabled, isEmpty, isIndexed, isOrdered, isTransactional, isWriteAllowed, size |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
clear, hashCode, isEmpty, size |
Constructor Detail |
---|
public StoredMap(DataStore store, DataBinding keyBinding, DataBinding valueBinding, boolean writeAllowed)
DataStore
.
store
- is the DataStore underlying the new collection.keyBinding
- is the binding used to translate between key buffers
and key objects.valueBinding
- is the binding used to translate between value
buffers and value objects.writeAllowed
- is true to create a read-write collection or false
to create a read-only collection.
java.lang.IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DbException
is thrown.public StoredMap(DataStore store, DataBinding keyBinding, EntityBinding valueEntityBinding, boolean writeAllowed)
DataStore
.
store
- is the DataStore underlying the new collection.keyBinding
- is the binding used to translate between key buffers
and key objects.valueEntityBinding
- is the binding used to translate between
key/value buffers and entity value objects.writeAllowed
- is true to create a read-write collection or false
to create a read-only collection.
java.lang.IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DbException
is thrown.public StoredMap(DataIndex index, DataBinding keyBinding, DataBinding valueBinding, boolean writeAllowed)
DataIndex
.
index
- is the DataIndex underlying the new collection.keyBinding
- is the binding used to translate between key buffers
and key objects.valueBinding
- is the binding used to translate between value
buffers and value objects.writeAllowed
- is true to create a read-write collection or false
to create a read-only collection.
java.lang.IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DbException
is thrown.public StoredMap(DataIndex index, DataBinding keyBinding, EntityBinding valueEntityBinding, boolean writeAllowed)
DataIndex
.
index
- is the DataIndex underlying the new collection.keyBinding
- is the binding used to translate between key buffers
and key objects.valueEntityBinding
- is the binding used to translate between
key/value buffers and entity value objects.writeAllowed
- is true to create a read-write collection or false
to create a read-only collection.
java.lang.IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DbException
is thrown.Method Detail |
---|
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.Object get(java.lang.Object key)
Map.get(java.lang.Object)
interface.
get
in interface java.util.Map
RuntimeExceptionWrapper
- if a DbException
is thrown.public java.lang.Object put(java.lang.Object key, java.lang.Object value)
Map.put(K, V)
interface.
The key parameter may be null if an entity binding is used and the key will be derived from the value (entity) parameter. If an entity binding is used and the key parameter is non-null, then the key parameter must be equal to the key derived from the value parameter.
put
in interface java.util.Map
java.lang.UnsupportedOperationException
- if the collection is indexed, or
if the collection is read-only.
java.lang.IllegalArgumentException
- if an entity value binding is used and
the primary key of the value given is different than the existing stored
primary key.
RuntimeExceptionWrapper
- if a DbException
is thrown.public java.lang.Object append(java.lang.Object value)
PrimaryKeyAssigner
is associated with
Store for this map, it will be used to assigned the returned key.
Otherwise the Store must be a QUEUE or RECNO database and the next
available record number is assigned as the key.
This method does not exist in the standard Map
interface.
value
- the value to be appended.
java.lang.UnsupportedOperationException
- if the collection is indexed, or
if the collection is read-only, or if the Store has no PrimaryKeyAssigner
and is not a QUEUE or RECNO
database.
RuntimeExceptionWrapper
- if a DbException
is thrown.public java.lang.Object remove(java.lang.Object key)
Map.remove(java.lang.Object)
interface.
remove
in interface java.util.Map
java.lang.UnsupportedOperationException
- if the collection is read-only.
RuntimeExceptionWrapper
- if a DbException
is thrown.public boolean containsKey(java.lang.Object key)
Map.containsKey(java.lang.Object)
interface.
containsKey
in interface java.util.Map
RuntimeExceptionWrapper
- if a DbException
is thrown.public boolean containsValue(java.lang.Object value)
Map.containsValue(java.lang.Object)
interface.
containsValue
in interface java.util.Map
RuntimeExceptionWrapper
- if a DbException
is thrown.public void putAll(java.util.Map map)
Map.putAll(java.util.Map extends K, ? extends V>)
interface.
putAll
in interface java.util.Map
java.lang.UnsupportedOperationException
- if the collection is read-only, or
if the collection is indexed.
RuntimeExceptionWrapper
- if a DbException
is thrown.public java.util.Set keySet()
SortedSet
is returned if the map is ordered.
The returned collection will be read-only if the map is read-only.
This method conforms to the Map.keySet()
interface.
keySet
in interface java.util.Map
StoredKeySet
or a StoredSortedKeySet
for this
map.
RuntimeExceptionWrapper
- if a DbException
is thrown.StoredContainer.isOrdered()
,
StoredContainer.isWriteAllowed()
public java.util.Set entrySet()
SortedSet
is returned if the map is ordered.
The returned collection will be read-only if the map is read-only.
This method conforms to the Map.entrySet()
interface.
entrySet
in interface java.util.Map
StoredEntrySet
or a StoredSortedEntrySet
for
this map.
RuntimeExceptionWrapper
- if a DbException
is thrown.StoredContainer.isOrdered()
,
StoredContainer.isWriteAllowed()
public java.util.Collection values()
SortedSet
is returned if the map is ordered and the
value/entity binding can be used to derive the map's key from its
value/entity object.
The returned collection will be read-only if the map is read-only.
This method conforms to the Map.entrySet()
interface.
values
in interface java.util.Map
StoredEntrySet
or a StoredSortedEntrySet
for
this map.
RuntimeExceptionWrapper
- if a DbException
is thrown.StoredContainer.isOrdered()
,
StoredContainer.isWriteAllowed()
public java.util.Collection duplicates(java.lang.Object key)
Map
interface.
If no mapping for the given key is present, an empty collection is returned. If duplicates are not allowed, at most a single value will be in the collection returned. If duplicates are allowed, the returned collection's add() method may be used to add values for the given key.
key
- is the key for which values are to be returned.
RuntimeExceptionWrapper
- if a DbException
is thrown.public boolean equals(java.lang.Object other)
Map.equals(java.lang.Object)
interface.
equals
in interface java.util.Map
equals
in class java.lang.Object
RuntimeExceptionWrapper
- if a DbException
is thrown.public java.lang.String toString()
toString
in class java.lang.Object
RuntimeExceptionWrapper
- if a DbException
is thrown.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |