Interface NoSqlConnection<W,T extends NoSqlObject<W>>
-
- Type Parameters:
T- Specifies which implementation ofNoSqlObjectthis connection provides.W- Specifies which type of database object is wrapped by theNoSqlObjectimplementation provided.
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
AbstractNoSqlConnection,CouchDbConnection
public interface NoSqlConnection<W,T extends NoSqlObject<W>> extends java.io.CloseableRepresents a connection to the NoSQL database. Serves as a factory for new (empty) objects and an endpoint for inserted objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the underlying connection.T[]createList(int length)Creates an array of the specified length typed to match theNoSqlObjectimplementation appropriate for this provider.TcreateObject()Instantiates and returns aNoSqlObjectinstance whose properties can be configured before ultimate insertion viainsertObject(NoSqlObject).voidinsertObject(NoSqlObject<W> object)Inserts the given object into the underlying NoSQL database.booleanisClosed()Indicates whether the underlying connection is closed.
-
-
-
Method Detail
-
createObject
T createObject()
Instantiates and returns aNoSqlObjectinstance whose properties can be configured before ultimate insertion viainsertObject(NoSqlObject).- Returns:
- a new object.
- See Also:
NoSqlObject
-
createList
T[] createList(int length)
Creates an array of the specified length typed to match theNoSqlObjectimplementation appropriate for this provider.- Parameters:
length- the length of the array to create.- Returns:
- a new array.
- See Also:
NoSqlObject
-
insertObject
void insertObject(NoSqlObject<W> object)
Inserts the given object into the underlying NoSQL database.- Parameters:
object- The object to insert.
-
close
void close()
Closes the underlying connection. This method call should be idempotent. Only the first call should have any effect; all further calls should be ignored. It's possible the underlying connection is stateless (such as an HTTP web service), in which case this method would be a no-op. This method should also commit any open transactions, if applicable and if not already committed.If this connection is part of a connection pool, executing this method should commit the transaction and return the connection to the pool, but it should not actually close the underlying connection.
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
isClosed
boolean isClosed()
Indicates whether the underlying connection is closed. If the underlying connection is stateless (such as an HTTP web service), this method would likely always return true. Essentially, this method should only returntrueif a call toinsertObject(NoSqlObject)will fail due to the state of this object.- Returns:
trueif this object is considered closed.
-
-