Package rife.database
Class DbConnectionUser<ResultType,DataType>
java.lang.Object
rife.database.DbConnectionUser<ResultType,DataType>
- All Implemented Interfaces:
Cloneable
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a new DbConnectionUser.DbConnectionUser
(DataType data) Create a new DbConnectionUser with a data object. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Simply clones the instance with the default clone method since this class contains no member variables.getData()
Retrieve the data object that was provided to the constructor.void
throwException
(Exception exception) Calling this method makes it possible to throw a checked exception from within this class.abstract ResultType
useConnection
(DbConnection connection) Should be implemented by all extending classes.
-
Field Details
-
data_
-
-
Constructor Details
-
DbConnectionUser
public DbConnectionUser()Create a new DbConnectionUser.- Since:
- 1.0
-
DbConnectionUser
Create a new DbConnectionUser with a data object.- Parameters:
data
- a user data object to be stored locally- Since:
- 1.0
-
-
Method Details
-
getData
Retrieve the data object that was provided to the constructor.- Returns:
- the provided data object; or
null
if no data object was provided - Since:
- 1.0
-
throwException
Calling this method makes it possible to throw a checked exception from within this class.To catch it you should surround the
reserveConnection
with atry-catch
block that catchesInnerClassException
. The original exception is then available throughgetCause()
and can for example be rethrown.- Parameters:
exception
- the exception to be thrown- Throws:
InnerClassException
- when a checked exception needs to be thrown from within this class and caught outside the caller.- Since:
- 1.0
-
useConnection
Should be implemented by all extending classes.- Parameters:
connection
- the connection that should be used- Throws:
InnerClassException
- Since:
- 1.0
-
clone
Simply clones the instance with the default clone method since this class contains no member variables.
-