KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibatis > sqlmap > engine > mapping > result > ResultMap


1 /*
2  * Copyright 2004 Clinton Begin
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.ibatis.sqlmap.engine.mapping.result;
17
18
19 import com.ibatis.sqlmap.engine.scope.RequestScope;
20
21 import java.sql.ResultSet JavaDoc;
22 import java.sql.SQLException JavaDoc;
23
24 /**
25  * This is a grouping of ResultMapping objects used to map results back to objects
26  */

27 public interface ResultMap {
28
29   public static final Object JavaDoc NO_VALUE = new Object JavaDoc();
30
31   /**
32    * A way to identify the ResultMap
33    *
34    * @return - an ID
35    */

36   public String JavaDoc getId();
37
38   /**
39    * Perform the mapping, and return the results
40    *
41    * @param request - the request scope
42    * @param rs - the result set to map
43    *
44    * @return - an object array with the data in it
45    *
46    * @throws SQLException - if an exception is thrown processing the results
47    */

48   public Object JavaDoc[] getResults(RequestScope request, ResultSet JavaDoc rs)
49       throws SQLException JavaDoc;
50
51   /**
52    * Callback method for RowHandler
53    *
54    * @param request - the request scope
55    * @param resultObject - the object being populated
56    * @param values - the values from the database
57    *
58    * @return - the populated object
59    */

60   public Object JavaDoc setResultObjectValues(RequestScope request, Object JavaDoc resultObject, Object JavaDoc[] values);
61
62   /**
63    * Getter for the ResultMapping objects
64    *
65    * @return - an array of ResultMapping objects
66    */

67   public ResultMapping[] getResultMappings();
68
69   /**
70    * Getter for the class that data wil be mapped into
71    *
72    * @return - the class
73    */

74   public Class JavaDoc getResultClass();
75
76   /**
77    * Gets a unique key based on the values provided.
78    * @param values Result values representing a single row of results.
79    * @return The unique key.
80    */

81   public Object JavaDoc getUniqueKey(Object JavaDoc[] values);
82
83   public ResultMap resolveSubMap (RequestScope request, ResultSet JavaDoc rs) throws SQLException JavaDoc;
84
85   public Discriminator getDiscriminator();
86 }
87
Popular Tags