|
Berkeley DB version 4.3.29 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sleepycat.collections.StoredContainer com.sleepycat.collections.StoredMap
A Map view of a Database
.
Note that this class does not conform to the standard Java collections interface in the following ways:
StoredContainer.size()
method always throws
UnsupportedOperationException
because, for performance reasons,
databases do not maintain their total record count.StoredIterator.close()
or StoredIterator.close(java.util.Iterator)
to release the underlying database cursor resources.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 inherited from class java.util.Map |
Map.Entry |
Constructor Summary | |
StoredMap(Database database,
EntryBinding keyBinding,
EntityBinding valueEntityBinding,
boolean writeAllowed)
Creates a map entity view of a Database . |
|
StoredMap(Database database,
EntryBinding keyBinding,
EntityBinding valueEntityBinding,
PrimaryKeyAssigner keyAssigner)
Creates a map entity view of a Database with a PrimaryKeyAssigner . |
|
StoredMap(Database database,
EntryBinding keyBinding,
EntryBinding valueBinding,
boolean writeAllowed)
Creates a map view of a Database . |
|
StoredMap(Database database,
EntryBinding keyBinding,
EntryBinding valueBinding,
PrimaryKeyAssigner keyAssigner)
Creates a map view of a Database with a PrimaryKeyAssigner . |
Method Summary | |
Object |
append(Object value)
Appends a given value returning the newly assigned key. |
boolean |
containsKey(Object key)
Returns true if this map contains the specified key. |
boolean |
containsValue(Object value)
Returns true if this map contains the specified value. |
Collection |
duplicates(Object key)
Returns a new collection containing the values mapped to the given key in this map. |
Set |
entrySet()
Returns a set view of the mappings contained in this map. |
boolean |
equals(Object other)
Compares the specified object with this map for equality. |
Object |
get(Object key)
Returns the value to which this map maps the specified key. |
int |
hashCode()
|
Set |
keySet()
Returns a set view of the keys contained in this map. |
Object |
put(Object key,
Object value)
Associates the specified value with the specified key in this map (optional operation). |
void |
putAll(Map map)
Copies all of the mappings from the specified map to this map (optional operation). |
Object |
remove(Object key)
Removes the mapping for this key from this map if present (optional operation). |
String |
toString()
Converts the map to a string representation for debugging. |
Collection |
values()
Returns a collection view of the values contained in this map. |
Methods inherited from class com.sleepycat.collections.StoredContainer |
areDuplicatesAllowed, areDuplicatesOrdered, areKeysRenumbered, clear, isDirtyRead, isDirtyReadAllowed, isEmpty, isOrdered, isSecondary, isTransactional, isWriteAllowed, size |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
clear, isEmpty, size |
Constructor Detail |
public StoredMap(Database database, EntryBinding keyBinding, EntryBinding valueBinding, boolean writeAllowed)
Database
.
database
- is the Database 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.
IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public StoredMap(Database database, EntryBinding keyBinding, EntryBinding valueBinding, PrimaryKeyAssigner keyAssigner)
Database
with a PrimaryKeyAssigner
. Writing is allowed for the created map.
database
- is the Database 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.keyAssigner
- is used by the append(java.lang.Object)
method to assign
primary keys.
IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public StoredMap(Database database, EntryBinding keyBinding, EntityBinding valueEntityBinding, boolean writeAllowed)
Database
.
database
- is the Database 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.
IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public StoredMap(Database database, EntryBinding keyBinding, EntityBinding valueEntityBinding, PrimaryKeyAssigner keyAssigner)
Database
with a PrimaryKeyAssigner
. Writing is allowed for the created map.
database
- is the Database 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.keyAssigner
- is used by the append(java.lang.Object)
method to assign
primary keys.
IllegalArgumentException
- if formats are not consistently
defined or a parameter is invalid.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.Method Detail |
public Object get(Object key)
Map.get(java.lang.Object)
interface.
get
in interface Map
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public Object put(Object key, Object value)
Map.put(java.lang.Object, java.lang.Object)
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 Map
UnsupportedOperationException
- if the collection is indexed, or
if the collection is read-only.
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 DatabaseException
is thrown.public Object append(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.
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 DatabaseException
is thrown.public Object remove(Object key)
Map.remove(java.lang.Object)
interface.
remove
in interface Map
UnsupportedOperationException
- if the collection is read-only.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public boolean containsKey(Object key)
Map.containsKey(java.lang.Object)
interface.
containsKey
in interface Map
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public boolean containsValue(Object value)
Map.containsValue(java.lang.Object)
interface.
containsValue
in interface Map
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public void putAll(Map map)
Map.putAll(java.util.Map)
interface.
putAll
in interface Map
UnsupportedOperationException
- if the collection is read-only, or
if the collection is indexed.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public 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 Map
StoredKeySet
or a StoredSortedKeySet
for this
map.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.StoredContainer.isOrdered()
,
StoredContainer.isWriteAllowed()
public 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 Map
StoredEntrySet
or a StoredSortedEntrySet
for
this map.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.StoredContainer.isOrdered()
,
StoredContainer.isWriteAllowed()
public 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 Map
StoredValueSet
or a StoredSortedValueSet
for
this map.
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.StoredContainer.isOrdered()
,
StoredContainer.isWriteAllowed()
public Collection duplicates(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 DatabaseException
is thrown.public boolean equals(Object other)
Map.equals(java.lang.Object)
interface.
equals
in interface Map
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.public int hashCode()
hashCode
in interface Map
public String toString()
RuntimeExceptionWrapper
- if a DatabaseException
is thrown.
|
Berkeley DB version 4.3.29 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |