Package com.sleepycat.collections
Class StoredContainer
java.lang.Object
com.sleepycat.collections.StoredContainer
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
StoredCollection,StoredMap
A abstract base class for all stored collections and maps. This class
provides implementations of methods that are common to the
Collection and the Map interfaces, namely
clear(), isEmpty() and size().
In addition, this class provides the following methods for stored collections only. Note that the use of these methods is not compatible with the standard Java collections interface.
-
Method Summary
Modifier and TypeMethodDescriptionfinal booleanReturns whether duplicate keys are allowed in this container.final booleanReturns whether duplicate keys are allowed and sorted by element value.final booleanReturns whether key ranges are allowed in this container.final booleanReturns whether keys are renumbered when insertions and deletions occur.voidclear()Removes all mappings or elements from this map or collection (optional operation).final CursorConfigReturns the cursor configuration that is used for all operations performed via this container.booleanisEmpty()Returns true if this map or collection contains no mappings or elements.final booleanReturns whether keys are ordered in this container.final booleanReturns whether this container is a view on a secondary database rather than directly on a primary database.final booleanReturns whether the databases underlying this container are transactional.final booleanReturns true if this is a read-write container or false if this is a read-only container.abstract intsize()Returns a non-transactional count of the records in the collection or map.
-
Method Details
-
isWriteAllowed
public final boolean isWriteAllowed()Returns true if this is a read-write container or false if this is a read-only container. This method does not exist in the standardMaporCollectioninterfaces.- Returns:
- whether write is allowed.
-
getCursorConfig
Returns the cursor configuration that is used for all operations performed via this container. For example, ifCursorConfig.getReadUncommittedreturns true, data will be read that is modified but not committed. This method does not exist in the standardMaporCollectioninterfaces.- Returns:
- the cursor configuration, or null if no configuration has been specified.
-
isTransactional
public final boolean isTransactional()Returns whether the databases underlying this container are transactional. Even in a transactional environment, a database will be transactional only if it was opened within a transaction or if the auto-commit option was specified when it was opened. This method does not exist in the standardMaporCollectioninterfaces.- Returns:
- whether the database is transactional.
-
areDuplicatesAllowed
public final boolean areDuplicatesAllowed()Returns whether duplicate keys are allowed in this container. Duplicates are optionally allowed for HASH and BTREE databases. This method does not exist in the standardMaporCollectioninterfaces.Note that the JE product only supports BTREE databases.
- Returns:
- whether duplicates are allowed.
-
areDuplicatesOrdered
public final boolean areDuplicatesOrdered()Returns whether duplicate keys are allowed and sorted by element value. Duplicates are optionally sorted for HASH and BTREE databases. This method does not exist in the standardMaporCollectioninterfaces.Note that the JE product only supports BTREE databases, and duplicates are always sorted.
- Returns:
- whether duplicates are ordered.
-
areKeysRenumbered
public final boolean areKeysRenumbered()Returns whether keys are renumbered when insertions and deletions occur. Keys are optionally renumbered for RECNO databases. This method does not exist in the standardMaporCollectioninterfaces.Note that the JE product does not support RECNO databases, and therefore keys are never renumbered.
- Returns:
- whether keys are renumbered.
-
isOrdered
public final boolean isOrdered()Returns whether keys are ordered in this container. Keys are ordered for BTREE, RECNO and QUEUE databases. This method does not exist in the standardMaporCollectioninterfaces.Note that the JE product only support BTREE databases, and therefore keys are always ordered.
- Returns:
- whether keys are ordered.
-
areKeyRangesAllowed
public final boolean areKeyRangesAllowed()Returns whether key ranges are allowed in this container. Key ranges are allowed only for BTREE databases. This method does not exist in the standardMaporCollectioninterfaces.Note that the JE product only supports BTREE databases, and therefore key ranges are always allowed.
- Returns:
- whether keys are ordered.
-
isSecondary
public final boolean isSecondary()Returns whether this container is a view on a secondary database rather than directly on a primary database. This method does not exist in the standardMaporCollectioninterfaces.- Returns:
- whether the view is for a secondary database.
-
size
public abstract int size()Returns a non-transactional count of the records in the collection or map. This method conforms to theCollection.size()andMap.size()interfaces.- Throws:
RuntimeExceptionWrapper- if a checked exception is thrown, including aDatabaseExceptionon BDB (C edition).
-
isEmpty
public boolean isEmpty()Returns true if this map or collection contains no mappings or elements. This method conforms to theCollection.isEmpty()andMap.isEmpty()interfaces.- Returns:
- whether the container is empty.
- Throws:
RuntimeExceptionWrapper- if a checked exception is thrown, including aDatabaseExceptionon BDB (C edition).
-
clear
public void clear()Removes all mappings or elements from this map or collection (optional operation). This method conforms to theCollection.clear()andMap.clear()interfaces.- Throws:
UnsupportedOperationException- if the container is read-only.RuntimeExceptionWrapper- if a checked exception is thrown, including aDatabaseExceptionon BDB (C edition).
-