|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.dbutils.handlers.AbstractKeyedHandler<K,V>
K
- the type of keys maintained by the returned mapV
- the type of mapped valuespublic abstract class AbstractKeyedHandler<K,V>
ResultSetHandler
implementation that returns a Map.
ResultSet
rows are converted into objects (Vs) which are then stored
in a Map under the given keys (Ks).
ResultSetHandler
Constructor Summary | |
---|---|
AbstractKeyedHandler()
|
Method Summary | |
---|---|
protected abstract K |
createKey(ResultSet rs)
This factory method is called by handle() to retrieve the
key value from the current ResultSet row. |
protected Map<K,V> |
createMap()
This factory method is called by handle() to create the Map
to store records in. |
protected abstract V |
createRow(ResultSet rs)
This factory method is called by handle() to store the
current ResultSet row in some object. |
Map<K,V> |
handle(ResultSet rs)
Convert each row's columns into a Map and store then in a Map under ResultSet.getObject(key) key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractKeyedHandler()
Method Detail |
---|
public Map<K,V> handle(ResultSet rs) throws SQLException
Map
under ResultSet.getObject(key)
key.
handle
in interface ResultSetHandler<Map<K,V>>
rs
- ResultSet
to process.
Map
, never null
.
SQLException
- if a database access error occursResultSetHandler.handle(java.sql.ResultSet)
protected Map<K,V> createMap()
handle()
to create the Map
to store records in. This implementation returns a HashMap
instance.
protected abstract K createKey(ResultSet rs) throws SQLException
handle()
to retrieve the
key value from the current ResultSet
row.
rs
- ResultSet to create a key from
SQLException
- if a database access error occursprotected abstract V createRow(ResultSet rs) throws SQLException
handle()
to store the
current ResultSet
row in some object.
rs
- ResultSet to create a row from
SQLException
- if a database access error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |