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:
20: package org.apache.beehive.controls.system.jdbc;
21:
22: import org.apache.beehive.controls.api.context.ControlBeanContext;
23:
24: import java.lang.reflect.Method;
25: import java.sql.ResultSet;
26: import java.util.Calendar;
27: import java.util.Iterator;
28:
29: /**
30: * Default ResultSetMapper implementation for Iterators.
31: */
32: public class DefaultIteratorResultSetMapper extends ResultSetMapper {
33:
34: /**
35: * Map a ResultSet to an object type
36: * Type of object to interate over is defined in the SQL annotation for the method.
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 Iterator object instance resulting from the ResultSet
43: */
44: public Iterator mapToResultType(ControlBeanContext context,
45: Method m, ResultSet resultSet, Calendar cal) {
46: return new ResultSetIterator(context, m, resultSet, cal);
47: }
48:
49: /**
50: * Can the ResultSet which this mapper uses be closed by the database control on return from its invoke() method?
51: * @return always returns false
52: */
53: public boolean canCloseResultSet() {
54: return false;
55: }
56: }
|