01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.controls.system.jdbc;
20:
21: import org.apache.beehive.controls.api.context.ControlBeanContext;
22:
23: import java.lang.reflect.Method;
24: import java.sql.ResultSet;
25: import java.util.Calendar;
26:
27: /**
28: * Extend this class to create new ResultSet mappers. The extended class will be invoked by the JdbcController
29: * when it is time to map a ResultSet to a method's return type.
30: *
31: * ResultSet mappers are specified on a per method basis using the SQL annotation's resultSetMapper field.
32: */
33: public abstract class ResultSetMapper {
34:
35: /**
36: * Map a ResultSet to an object type
37: *
38: * @param context A ControlBeanContext instance, see Beehive controls javadoc for additional information
39: * @param m Method assoicated with this call.
40: * @param resultSet Result set to map.
41: * @param cal A Calendar instance for time/date value resolution.
42: * @return The Object resulting from the ResultSet
43: */
44: public abstract Object mapToResultType(ControlBeanContext context,
45: Method m, ResultSet resultSet, Calendar cal);
46:
47: /**
48: * Can the ResultSet which this mapper uses be closed by the Jdbc control?
49: * @return true if the ResultSet can be closed by the JdbcControl
50: */
51: public boolean canCloseResultSet() {
52: return true;
53: }
54: }
|