Skip to content

Commit f7a9415

Browse files
committed
Merge pull request mybatis#353 from kazuki-ma/GenericTypeHandler
Update documents of ResultHandler and ResultContext as generic type.
2 parents 73e592a + 167ff16 commit f7a9415

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

src/site/es/xdoc/java-api.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ int delete(String statement)]]></source>
206206
<p>Finalmente hay tres versiones avanzadas de los métodos select que te permiten restringir el rango de filas devueltas, o proporcionar lógica de tratamiento de resultados personalizada, normalmente para grandes cantidades de datos.</p>
207207
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
208208
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
209-
void select (String statement, Object parameter, ResultHandler handler)
210-
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
209+
void select (String statement, Object parameter, ResultHandler<T> handler)
210+
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>
211211

212212
<p>El parámetro RowBounds hace que MyBatis salte los registros especificados y que limite los resultados devueltos a cierto número. La clase RowBounds tiene un constructor que recibe ambos el offset y el limit, y es inmutable.</p>
213213
<source>int offset = 100;
@@ -217,10 +217,10 @@ RowBounds rowBounds = new RowBounds(offset, limit);</source>
217217
<p>El rendimiento de algunos drivers puede variar mucho en este aspecto. Para un rendimiento optimo, usa tipos de ResultSet SCROLL_SENSITIVE o SCROLL_INSENSITIVE (es decir, no FORWARD_ONLY)</p>
218218
<p>El parámetro ResultHandler te permite manejar cada fila como tú quieras. Puedes añadirla a una lista, crear un Map, un Set, o descartar cada resultado y guardar solo cálculos. Puedes hacer casi todo lo que quieras con un ResultHandler, de hecho, es lo que MyBatis usa internamente para construir listas de ResultSets.</p>
219219
<p>La interfaz es muy sencilla:</p>
220-
<source>package org.apache.ibatis.session;
221-
public interface ResultHandler {
222-
void handleResult(ResultContext context);
223-
}</source>
220+
<source><![CDATA[package org.apache.ibatis.session;
221+
public interface ResultHandler<T> {
222+
void handleResult(ResultContext<? extends T> context);
223+
}]]></source>
224224

225225
<p>El parámetro ResultContext te da acceso al objeto resultado en sí mismo, un contador del número de objetos creados y un método booleano stop() que te permite indicar a MyBatis que pare la carga de datos.</p>
226226

src/site/ja/xdoc/java-api.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ int delete(String statement)]]></source>
207207
<p>最後に、高度な処理を行うための select メソッドがあります。これらは主に非常に大きなデータセットを扱う場合に、返される行の範囲を限定したり、カスタムの ResultHandler を使って独自に結果処理を行うことができるようになっています。</p>
208208
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
209209
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
210-
void select (String statement, Object parameter, ResultHandler handler)
211-
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
210+
void select (String statement, Object parameter, ResultHandler<T> handler)
211+
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>
212212

213213
<p>RowBounds 引数を渡すことによって、指定された数のレコードをスキップし、結果として返される行の数を制限することができます。RowBounds クラスはイミュータブルで、コンストラクタ引数として offset と limit を取ります。</p>
214214
<source>int offset = 100;
@@ -219,8 +219,8 @@ RowBounds rowBounds = new RowBounds(offset, limit);</source>
219219
<p>ResultHandler を渡すと、各行を自由に処理することができます。List に追加したり、Map や Set を作成することもできますし、結果を捨てて合計値のみを返すこともできます。ResultHandler を使えば好きな処理を行うことも可能で、MyBatis 自身も内部的に結果リストを構築するために ResultHandler を利用しています。</p>
220220
<p>ResultHandler インターフェイスは非常にシンプルです。</p>
221221
<source>package org.mybatis.executor.result;
222-
public interface ResultHandler {
223-
void handleResult(ResultContext context);
222+
public interface ResultHandler<T> {
223+
void handleResult(ResultContext<? extends T> context);
224224
}</source>
225225

226226
<p>引数 ResultContext を介して結果オブジェクトにアクセスすることができます。ResultContext#getResultCount() メソッドは作成された結果オブジェクトの数を返します。ResultContext#stop() メソッドを呼び出すと、それ以上結果を読み込まないよう MyBatis に指示します。</p>

src/site/ko/xdoc/java-api.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ int delete(String statement)]]></source>
249249

250250
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
251251
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
252-
void select (String statement, Object parameter, ResultHandler handler)
253-
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
252+
void select (String statement, Object parameter, ResultHandler<T> handler)
253+
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>
254254

255255
<p>RowBounds 파라미터는 MyBatis 로 하여금 특정 개수 만큼의 레코드를 건너띄게 한다. RowBounds 클래스는 offset 과
256256
limit 둘다 가지는 생성자가 있다.</p>
@@ -264,10 +264,10 @@ RowBounds rowBounds = new RowBounds(offset, limit);</source>
264264
각각의 결과를 그냥 던질수도 있다. ResultHandler 로 많은 것을 할 수 있고 MyBatis 는 결과셋을 다루기 위해 내부적으로
265265
사용한다.</p>
266266
<p>인터페이스는 매우 간단하다.</p>
267-
<source>package org.apache.ibatis.session;
268-
public interface ResultHandler {
269-
void handleResult(ResultContext context);
270-
}</source>
267+
<source><![CDATA[package org.apache.ibatis.session;
268+
public interface ResultHandler<T> {
269+
void handleResult(ResultContext<? extends T> context);
270+
}]]></source>
271271

272272
<p>ResultContext 파라미터는 결과 객체에 접근할 수 있도록 해준다.</p>
273273

src/site/xdoc/java-api.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ int delete(String statement)]]></source>
212212
<p>Finally, there are three advanced versions of the select methods that allow you to restrict the range of rows to return, or provide custom result handling logic, usually for very large data sets.</p>
213213
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
214214
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
215-
void select (String statement, Object parameter, ResultHandler handler)
216-
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
215+
void select (String statement, Object parameter, ResultHandler<T> handler)
216+
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>
217217

218218
<p>The RowBounds parameter causes MyBatis to skip the number of records specified, as well as limit the number of results returned to some number. The RowBounds class has a constructor to take both the offset and limit, and is otherwise immutable.</p>
219219
<source>int offset = 100;
@@ -223,10 +223,10 @@ RowBounds rowBounds = new RowBounds(offset, limit);</source>
223223
<p>Different drivers are able to achieve different levels of efficiency in this regard. For the best performance, use result set types of SCROLL_SENSITIVE or SCROLL_INSENSITIVE (in other words: not FORWARD_ONLY).</p>
224224
<p>The ResultHandler parameter allows you to handle each row however you like. You can add it to a List, create a Map, Set, or throw each result away and instead keep only rolled up totals of calculations. You can do pretty much anything with the ResultHandler, and it's what MyBatis uses internally itself to build result set lists.</p>
225225
<p>The interface is very simple.</p>
226-
<source>package org.apache.ibatis.session;
227-
public interface ResultHandler {
228-
void handleResult(ResultContext context);
229-
}</source>
226+
<source><![CDATA[package org.apache.ibatis.session;
227+
public interface ResultHandler<T> {
228+
void handleResult(ResultContext<? extends T> context);
229+
}]]></source>
230230

231231
<p>The ResultContext parameter gives you access to the result object itself, a count of the number of result objects created, and a Boolean stop() method that you can use to stop MyBatis from loading any more results.</p>
232232

src/site/zh/xdoc/java-api.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ int delete(String statement)]]></source>
330330
</p>
331331
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
332332
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
333-
void select (String statement, Object parameter, ResultHandler handler)
334-
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
333+
void select (String statement, Object parameter, ResultHandler<T> handler)
334+
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>
335335

336336
<p>
337337
RowBounds 参数会告诉 MyBatis 略过指定数量的记录,还有限制返回结果的数量。
@@ -352,10 +352,10 @@ Set
352352
那就是 MyBatis 内部创建结果集列表。
353353
</p>
354354
<p>它的接口很简单。</p>
355-
<source>package org.apache.ibatis.session;
356-
public interface ResultHandler {
357-
void handleResult(ResultContext context);
358-
}</source>
355+
<source><![CDATA[package org.apache.ibatis.session;
356+
public interface ResultHandler<T> {
357+
void handleResult(ResultContext<? extends T> context);
358+
}]]></source>
359359

360360
<p>
361361
ResultContext 参数给你访问结果对象本身的方法,

0 commit comments

Comments
 (0)