Skip to content

Update documents of ResultHandler and ResultContext as generic type. #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/site/es/xdoc/java-api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ int delete(String statement)]]></source>
<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>
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
void select (String statement, Object parameter, ResultHandler handler)
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
void select (String statement, Object parameter, ResultHandler<T> handler)
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>

<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>
<source>int offset = 100;
Expand All @@ -217,10 +217,10 @@ RowBounds rowBounds = new RowBounds(offset, limit);</source>
<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>
<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>
<p>La interfaz es muy sencilla:</p>
<source>package org.apache.ibatis.session;
public interface ResultHandler {
void handleResult(ResultContext context);
}</source>
<source><![CDATA[package org.apache.ibatis.session;
public interface ResultHandler<T> {
void handleResult(ResultContext<? extends T> context);
}]]></source>

<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>

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

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

<p>引数 ResultContext を介して結果オブジェクトにアクセスすることができます。ResultContext#getResultCount() メソッドは作成された結果オブジェクトの数を返します。ResultContext#stop() メソッドを呼び出すと、それ以上結果を読み込まないよう MyBatis に指示します。</p>
Expand Down
12 changes: 6 additions & 6 deletions src/site/ko/xdoc/java-api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ int delete(String statement)]]></source>

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

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

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

Expand Down
12 changes: 6 additions & 6 deletions src/site/xdoc/java-api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ int delete(String statement)]]></source>
<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>
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
void select (String statement, Object parameter, ResultHandler handler)
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
void select (String statement, Object parameter, ResultHandler<T> handler)
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>

<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>
<source>int offset = 100;
Expand All @@ -223,10 +223,10 @@ RowBounds rowBounds = new RowBounds(offset, limit);</source>
<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>
<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>
<p>The interface is very simple.</p>
<source>package org.apache.ibatis.session;
public interface ResultHandler {
void handleResult(ResultContext context);
}</source>
<source><![CDATA[package org.apache.ibatis.session;
public interface ResultHandler<T> {
void handleResult(ResultContext<? extends T> context);
}]]></source>

<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>

Expand Down
12 changes: 6 additions & 6 deletions src/site/zh/xdoc/java-api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ int delete(String statement)]]></source>
</p>
<source><![CDATA[<E> List<E> selectList (String statement, Object parameter, RowBounds rowBounds)
<K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, RowBounds rowbounds)
void select (String statement, Object parameter, ResultHandler handler)
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler handler)]]></source>
void select (String statement, Object parameter, ResultHandler<T> handler)
void select (String statement, Object parameter, RowBounds rowBounds, ResultHandler<T> handler)]]></source>

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

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