|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.database.DbRowProcessor
public abstract class DbRowProcessor
This abstract base class should be used to implement classes that process one
row in a database query resulset. The fetch method of a
DbQueryManager requires an instance of a
DbRowProcessor and calls its processRow
method each time it is called.
The DbRowProcessor instance can then work with the result set
and extract all needed data. It is free to implement any logic to be
able to return the retrieved data in an acceptable form to the user.
A class that extends DbRowProcessor can for example take a
Template instance as the argument of its constructor and
progressively fill in each resulting row in a HTML table. This, without
having to maintain the query results in memory to be able to provide it to a
seperate method which is responsible for the handling of the output. Using a
DbRowProcessor thus allows for perfect seperation and
abstraction of result processing without having to be burdened with possible
large memory usage or large object allocation.
processRow(ResultSet resultSet),
DbQueryManager| Constructor Summary | |
|---|---|
DbRowProcessor()
|
|
| Method Summary | |
|---|---|
Object |
clone()
Simply clones the instance with the default clone method since this class contains no object member variables. |
abstract boolean |
processRow(ResultSet resultSet)
This method has to be implemented by each class that extends the DbRowProcessor class. |
boolean |
wasSuccessful()
Indicates whether the processing of the row was successful. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DbRowProcessor()
| Method Detail |
|---|
public abstract boolean processRow(ResultSet resultSet)
throws SQLException
DbRowProcessor class. It has to contain all the logic that
should be executed for each row of a resultset.
resultSet - the ResultSet instance that was provided to
the DbQueryManager's fetch method.
true if the processing is considered successful; or
false if the processing is considered failed.
Note: this return value is purely indicative and unless the user does
checks with the wasSuccessful() method, it will have no
influence on anything.
SQLException - when a database error occurs, it's thus not
necessary to catch all the possible SQLExceptions inside
this method. They'll be caught higher up and be transformed in
DatabaseExceptions.DbQueryManager.fetch(ResultSet, DbRowProcessor),
wasSuccessful()public final boolean wasSuccessful()
true if the processing was successful; or
false if the processing was unsuccessful.
public Object clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||