KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jodd > db > orm > mapper > ResultSetMapper


1 // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
2

3 package jodd.db.orm.mapper;
4
5 import java.sql.ResultSet JavaDoc;
6
7 /**
8  * ResultSet mapper which implementations parse objects from one result set row.
9  * 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     public 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     public void close();
30
31     /**
32      * Return JDBC result set.
33      */

34     public ResultSet JavaDoc getResultSet();
35
36
37     // ---------------------------------------------------------------- parse types
38

39     /**
40      * Parse objects from result set row to specified types.
41      */

42     public Object JavaDoc[] parseObjects(Class JavaDoc... types);
43
44     /**
45      * Parse single object from result set row to specified type.
46      * @see #parseObjects(Class[])
47      */

48     public Object JavaDoc parseOneObject(Class JavaDoc... types);
49
50     // ---------------------------------------------------------------- auto-parse
51

52     /**
53      * Parses objects from result set row to mapped types. Types can be resolved
54      * by using {@link jodd.db.orm.DbOrm} mapping utility.
55      */

56     public Object JavaDoc[] parseObjects();
57
58     /**
59      * Parses single object from result set to single type. Type can be resolved
60      * by using {@link jodd.db.orm.DbOrm} mapping utility.
61      * @see #parseObjects(Class[])
62      */

63     public Object JavaDoc parseOneObject();
64 }
65
Popular Tags