01: // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
02:
03: package jodd.db.orm.mapper;
04:
05: import java.sql.ResultSet;
06:
07: /**
08: * ResultSet mapper which implementations parse objects from one result set row.
09: * There are two ways of mapping. The basic way is mapping against provided
10: * entity types. The second, extended, way is auto-mapping, where no types
11: * are provided. Instead, they are mapped by {@link jodd.db.orm.DbOrm} or
12: * similar external class.
13: * <p>
14: * This interface also specifies some simple and most used ResultSet wrapper methods.
15: */
16: public interface ResultSetMapper {
17:
18: // ---------------------------------------------------------------- moving
19:
20: /**
21: * Moves the cursor down one row from its current position.
22: */
23: boolean next();
24:
25: /**
26: * Releases this ResultSet object's database and JDBC resources immediately instead of
27: * waiting for this to happen when it is automatically closed.
28: */
29: void close();
30:
31: /**
32: * Return JDBC result set.
33: */
34: ResultSet getResultSet();
35:
36: // ---------------------------------------------------------------- parse types
37:
38: /**
39: * Parse objects from result set row to specified types.
40: */
41: Object[] parseObjects(Class... types);
42:
43: /**
44: * Parse single object from result set row to specified type.
45: * @see #parseObjects(Class[])
46: */
47: Object parseOneObject(Class... types);
48:
49: }
|