Skip to content

Commit

Permalink
Minor doc changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
emacarron committed Apr 6, 2014
1 parent 3d87435 commit b33bc4c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 32 deletions.
14 changes: 9 additions & 5 deletions src/site/es/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ public class Author {
<code>ByteTypeHandler</code>
</td>
<td>
<code>java.lang.Byte</code>, byte
<code>java.lang.Byte</code>, <code>byte</code>
</td>
<td>
Cualquiera compatible con <code>NUMERIC</code> o <code>BYTE</code>
Expand Down Expand Up @@ -736,7 +736,7 @@ public class Author {
<code>FloatTypeHandler</code>
</td>
<td>
<code>java.lang.Float</code>, float
<code>java.lang.Float</code>, <code>float</code>
</td>
<td>
Cualquiera compatible con <code>NUMERIC</code> o <code>FLOAT</code>
Expand Down Expand Up @@ -933,8 +933,9 @@ public class Author {
</table>
<p>
Es posible sobrescribir los TypeHanders o crear TypeHanders personalizados para tratar tipos no soportados o no estándares.
Para ello, debes simplemente extender la clase <code>org.apache.ibatis.type.BaseTypeHandler</code> y
opcionalmente mapear tu nuevo TypeHandler a un tipo JDBC. Por ejemplo:
Para ello, debes implementar la interfaz <code>org.apache.ibatis.type.TypeHandler</code> o extender
la clase de ayuda <code>org.apache.ibatis.type.BaseTypeHandler</code> y opcionalmente mapear el TypeHandler a un tipo JDBC.
Por ejemplo:
</p>

<source><![CDATA[// ExampleTypeHandler.java
Expand Down Expand Up @@ -985,7 +986,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {
<p>El tipo JDBC asociado se puede especificar de dos maneras:</p>
<ul>
<li>
Añadiendo un atributo <code>jdbcType</code> al lemento typeHandler (por ejemplo: <code>jdbcType=VARCHAR</code>).
Añadiendo un atributo <code>jdbcType</code> al lemento typeHandler (por ejemplo: <code>jdbcType="VARCHAR"</code>).
</li>
<li>Añadiendo una anotación <code>@MappedJdbcTypes</code> a tu clase TypeHandler especificando la lista de tipos JDBC a la que asociarlo.
Esta anotación será ignorada si se ha especificado también un atributo <code>jdbcType</code>.
Expand Down Expand Up @@ -1128,6 +1129,9 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
public void setProperties(Properties properties) {
super.setProperties(properties);
}
public <T> boolean isCollection(Class<T> type) {
return Collection.class.isAssignableFrom(type);
}
}]]></source>

<source><![CDATA[<!-- mybatis-config.xml -->
Expand Down
5 changes: 4 additions & 1 deletion src/site/ja/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,10 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
public void setProperties(Properties properties) {
super.setProperties(properties);
}
}]]></source>
public <T> boolean isCollection(Class<T> type) {
return Collection.class.isAssignableFrom(type);
}}
]]></source>

<source><![CDATA[<!-- mybatis-config.xml -->
<objectFactory type="org.mybatis.example.ExampleObjectFactory">
Expand Down
11 changes: 7 additions & 4 deletions src/site/ko/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ public class Author {
<code>ByteTypeHandler</code>
</td>
<td>
<code>java.lang.Byte</code>, byte
<code>java.lang.Byte</code>, <code>byte</code>
</td>
<td>어떤 호환가능한 NUMERIC 또는 BYTE</td>
</tr>
Expand Down Expand Up @@ -701,7 +701,7 @@ public class Author {
<code>FloatTypeHandler</code>
</td>
<td>
<code>java.lang.Float</code>, float
<code>java.lang.Float</code>, <code>float</code>
</td>
<td>어떤 호환가능한 NUMERIC 또는 FLOAT</td>
</tr>
Expand Down Expand Up @@ -930,7 +930,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {

<p>관련된 JDBC타입은 두가지 방법으로 명시할 수 있다:</p>
<ul>
<li>typeHandler 요소에 <code>jdbcType</code> 속성 추가(예제: <code>jdbcType=VARCHAR</code>).
<li>typeHandler 요소에 <code>jdbcType</code> 속성 추가(예제: <code>jdbcType="VARCHAR"</code>).
</li>
<li>TypeHandler클래스에 관련된 JDBC타입의 목록을 정의하는 <code>@MappedJdbcTypes</code> 애노테이션 추가.
<code>jdbcType</code> 속성도 함께 정의되어 있다면 <code>@MappedJdbcTypes</code>는 무시된다.</li>
Expand Down Expand Up @@ -1071,7 +1071,10 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
public void setProperties(Properties properties) {
super.setProperties(properties);
}
}]]></source>
public <T> boolean isCollection(Class<T> type) {
return Collection.class.isAssignableFrom(type);
}}
]]></source>

<source><![CDATA[<!-- mybatis-config.xml -->
<objectFactory type="org.mybatis.example.ExampleObjectFactory">
Expand Down
18 changes: 10 additions & 8 deletions src/site/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ public class Author {
<code>ByteTypeHandler</code>
</td>
<td>
<code>java.lang.Byte</code>, byte
<code>java.lang.Byte</code>, <code>byte</code>
</td>
<td>
Any compatible <code>NUMERIC</code> or <code>BYTE</code>
Expand Down Expand Up @@ -855,7 +855,7 @@ public class Author {
<code>FloatTypeHandler</code>
</td>
<td>
<code>java.lang.Float</code>, float
<code>java.lang.Float</code>, <code>float</code>
</td>
<td>
Any compatible <code>NUMERIC</code> or <code>FLOAT</code>
Expand Down Expand Up @@ -1053,10 +1053,9 @@ public class Author {
</table>
<p>
You can override the type handlers or create your own to deal with
unsupported or non-standard types. To do so, simply extend
the
<code>org.apache.ibatis.type.BaseTypeHandler</code> class and optionally map your new
TypeHandler class to a JDBC type. For example:
unsupported or non-standard types. To do so, implement the interface <code>org.apache.ibatis.type.TypeHandler</code>
or extend the convenience class <code>org.apache.ibatis.type.BaseTypeHandler</code>
and optionally map it to a JDBC type. For example:
</p>

<source><![CDATA[// ExampleTypeHandler.java
Expand Down Expand Up @@ -1117,7 +1116,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {
<p>Associated JDBC type can be specified by two means:</p>
<ul>
<li>
Adding a <code>jdbcType</code> attribute to the typeHandler element (for example: <code>jdbcType=VARCHAR</code>).
Adding a <code>jdbcType</code> attribute to the typeHandler element (for example: <code>jdbcType="VARCHAR"</code>).
</li>
<li>Adding a <code>@MappedJdbcTypes</code> annotation to your TypeHandler class specifying
the list of JDBC types to associate it with. This annotation will be ignored if
Expand Down Expand Up @@ -1271,7 +1270,10 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
public void setProperties(Properties properties) {
super.setProperties(properties);
}
}]]></source>
public <T> boolean isCollection(Class<T> type) {
return Collection.class.isAssignableFrom(type);
}}
]]></source>

<source><![CDATA[<!-- mybatis-config.xml -->
<objectFactory type="org.mybatis.example.ExampleObjectFactory">
Expand Down
19 changes: 11 additions & 8 deletions src/site/zh/xdoc/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ public class Author {
<code>ByteTypeHandler</code>
</td>
<td>
<code>java.lang.Byte</code>, byte
<code>java.lang.Byte</code>, <code>byte</code>
</td>
<td>
任何兼容的数字或字节类型
Expand Down Expand Up @@ -817,7 +817,7 @@ public class Author {
<code>FloatTypeHandler</code>
</td>
<td>
<code>java.lang.Float</code>, float
<code>java.lang.Float</code>, <code>float</code>
</td>
<td>
任何兼容的数字或单精度浮点型
Expand Down Expand Up @@ -1017,10 +1017,10 @@ public class Author {
<p>
你可以重写类型处理器或创建你自己的类型处理器来处理不支持的或非标准的类型。
//TODO translation needed
To do so, simply extend
the
<code>org.apache.ibatis.type.BaseTypeHandler</code> class and optionally map your new
<code>TypeHandler</code> class to a JDBC type. 例如:

To do so, implement the interface <code>org.apache.ibatis.type.TypeHandler</code>
or extend the convenience class <code>org.apache.ibatis.type.BaseTypeHandler</code>
and optionally map it to a JDBC type. 例如:
</p>
<source><![CDATA[// ExampleTypeHandler.java
@MappedJdbcTypes(JdbcType.VARCHAR)
Expand Down Expand Up @@ -1080,7 +1080,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {
<p>Associated JDBC type can be specified by two means:</p>
<ul>
<li>
Adding a <code>jdbcType</code> attribute to the typeHandler element (for example: <code>jdbcType=VARCHAR</code>).
Adding a <code>jdbcType</code> attribute to the typeHandler element (for example: <code>jdbcType="VARCHAR"</code>).
</li>
<li>Adding a <code>@MappedJdbcTypes</code> annotation to your TypeHandler class specifying
the list of JDBC types to associate it with. This annotation will be ignored if
Expand Down Expand Up @@ -1230,7 +1230,10 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
public void setProperties(Properties properties) {
super.setProperties(properties);
}
}]]></source>
public <T> boolean isCollection(Class<T> type) {
return Collection.class.isAssignableFrom(type);
}}
]]></source>

<source><![CDATA[<!-- mybatis-config.xml -->
<objectFactory type="org.mybatis.example.ExampleObjectFactory">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ public List<URI> getNullableResult( CallableStatement cs, int columnIndex )
assertSame(fakeHandler, typeHandlerRegistry.getTypeHandler(new TypeReference<List<URI>>(){}));
}

@Ignore("See https://github.com/mybatis/mybatis-3/issues/165")
@Ignore("see https://github.com/mybatis/mybatis-3/issues/165")
@Test
public void registerWrapperHandlerBeforePrimitive() {

typeHandlerRegistry.register(int.class, DateTypeHandler.class);
public void shouldBindHandlersToWrapersAndPrimitivesIndividually() {
typeHandlerRegistry.register(Integer.class, DateTypeHandler.class);
assertSame(IntegerTypeHandler.class, typeHandlerRegistry.getTypeHandler(int.class).getClass());
typeHandlerRegistry.register(Integer.class, IntegerTypeHandler.class);

typeHandlerRegistry.register(int.class, DateTypeHandler.class);
assertSame(IntegerTypeHandler.class, typeHandlerRegistry.getTypeHandler(Integer.class).getClass());
assertSame(DateTypeHandler.class, typeHandlerRegistry.getTypeHandler(int.class).getClass());
typeHandlerRegistry.register(Integer.class, IntegerTypeHandler.class);
}

}

0 comments on commit b33bc4c

Please sign in to comment.