Package rife.database

Class DbConnectionUser<ResultType,DataType>

java.lang.Object
rife.database.DbConnectionUser<ResultType,DataType>
All Implemented Interfaces:
Cloneable

public abstract class DbConnectionUser<ResultType,DataType> extends Object implements Cloneable
  • Field Details

  • Constructor Details

    • DbConnectionUser

      public DbConnectionUser()
      Create a new DbConnectionUser.
      Since:
      1.0
    • DbConnectionUser

      public DbConnectionUser(DataType data)
      Create a new DbConnectionUser with a data object.
      Parameters:
      data - a user data object to be stored locally
      Since:
      1.0
  • Method Details

    • getData

      public DataType 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

      public void throwException(Exception exception) throws InnerClassException
      Calling this method makes it possible to throw a checked exception from within this class.

      To catch it you should surround the reserveConnection with a try-catch block that catches InnerClassException. The original exception is then available through getCause() 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

      public abstract ResultType useConnection(DbConnection connection) throws InnerClassException
      Should be implemented by all extending classes.
      Parameters:
      connection - the connection that should be used
      Throws:
      InnerClassException
      Since:
      1.0
    • clone

      public Object clone()
      Simply clones the instance with the default clone method since this class contains no member variables.
      Overrides:
      clone in class Object
      Since:
      1.0