Skip to content

Commit 57642b9

Browse files
committed
Merge pull request #678 from kazuki43zoo/polishing-cursor
Polishing codes for cursor feature
2 parents e91cd46 + 478b452 commit 57642b9

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

src/main/java/org/apache/ibatis/cursor/defaults/DefaultCursor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package org.apache.ibatis.cursor.defaults;
1717

1818
import org.apache.ibatis.cursor.Cursor;
19-
import org.apache.ibatis.cursor.CursorException;
2019
import org.apache.ibatis.executor.resultset.DefaultResultSetHandler;
2120
import org.apache.ibatis.executor.resultset.ResultSetWrapper;
2221
import org.apache.ibatis.mapping.ResultMap;
@@ -45,7 +44,7 @@ public class DefaultCursor<T> implements Cursor<T> {
4544
private final RowBounds rowBounds;
4645
private final ObjectWrapperResultHandler<T> objectWrapperResultHandler = new ObjectWrapperResultHandler<T>();
4746

48-
private CursorIterator cursorIterator = new CursorIterator();
47+
private final CursorIterator cursorIterator = new CursorIterator();
4948
private boolean iteratorRetrieved = false;
5049

5150
private CursorStatus status = CursorStatus.CREATED;
@@ -166,13 +165,13 @@ private int getReadItemsCount() {
166165
return indexWithRowBound + 1;
167166
}
168167

169-
private static class ObjectWrapperResultHandler<E> implements ResultHandler<E> {
168+
private static class ObjectWrapperResultHandler<T> implements ResultHandler<T> {
170169

171-
private E result;
170+
private T result;
172171

173172
@Override
174-
public void handleResult(ResultContext<? extends E> context) {
175-
this.result = (E) context.getResultObject();
173+
public void handleResult(ResultContext<? extends T> context) {
174+
this.result = context.getResultObject();
176175
context.stop();
177176
}
178177
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright 2009-2016 the original author or authors.
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+
/**
17+
* Default implementation for cursor feature
18+
*/
19+
package org.apache.ibatis.cursor.defaults;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2015 the original author or authors.
2+
* Copyright 2009-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,24 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.apache.ibatis.cursor;
17-
18-
import org.apache.ibatis.exceptions.PersistenceException;
19-
2016
/**
21-
* @author Guillaume Darmont / [email protected]
17+
* Base package for cursor feature
2218
*/
23-
public class CursorException extends PersistenceException {
24-
25-
public CursorException(String message) {
26-
super(message);
27-
}
28-
29-
public CursorException(String message, Throwable cause) {
30-
super(message, cause);
31-
}
32-
33-
public CursorException(Throwable cause) {
34-
super(cause);
35-
}
36-
}
19+
package org.apache.ibatis.cursor;

src/test/java/org/apache/ibatis/submitted/cursor_simple/CursorSimpleTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package org.apache.ibatis.submitted.cursor_simple;
1717

1818
import org.apache.ibatis.cursor.Cursor;
19-
import org.apache.ibatis.cursor.CursorException;
2019
import org.apache.ibatis.io.Resources;
2120
import org.apache.ibatis.jdbc.ScriptRunner;
2221
import org.apache.ibatis.session.RowBounds;

0 commit comments

Comments
 (0)