Skip to content

Commit b33bc4c

Browse files
committed
Minor doc changes.
1 parent 3d87435 commit b33bc4c

File tree

6 files changed

+47
-32
lines changed

6 files changed

+47
-32
lines changed

src/site/es/xdoc/configuration.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ public class Author {
692692
<code>ByteTypeHandler</code>
693693
</td>
694694
<td>
695-
<code>java.lang.Byte</code>, byte
695+
<code>java.lang.Byte</code>, <code>byte</code>
696696
</td>
697697
<td>
698698
Cualquiera compatible con <code>NUMERIC</code> o <code>BYTE</code>
@@ -736,7 +736,7 @@ public class Author {
736736
<code>FloatTypeHandler</code>
737737
</td>
738738
<td>
739-
<code>java.lang.Float</code>, float
739+
<code>java.lang.Float</code>, <code>float</code>
740740
</td>
741741
<td>
742742
Cualquiera compatible con <code>NUMERIC</code> o <code>FLOAT</code>
@@ -933,8 +933,9 @@ public class Author {
933933
</table>
934934
<p>
935935
Es posible sobrescribir los TypeHanders o crear TypeHanders personalizados para tratar tipos no soportados o no estándares.
936-
Para ello, debes simplemente extender la clase <code>org.apache.ibatis.type.BaseTypeHandler</code> y
937-
opcionalmente mapear tu nuevo TypeHandler a un tipo JDBC. Por ejemplo:
936+
Para ello, debes implementar la interfaz <code>org.apache.ibatis.type.TypeHandler</code> o extender
937+
la clase de ayuda <code>org.apache.ibatis.type.BaseTypeHandler</code> y opcionalmente mapear el TypeHandler a un tipo JDBC.
938+
Por ejemplo:
938939
</p>
939940

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

11331137
<source><![CDATA[<!-- mybatis-config.xml -->

src/site/ja/xdoc/configuration.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,10 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
11731173
public void setProperties(Properties properties) {
11741174
super.setProperties(properties);
11751175
}
1176-
}]]></source>
1176+
public <T> boolean isCollection(Class<T> type) {
1177+
return Collection.class.isAssignableFrom(type);
1178+
}}
1179+
]]></source>
11771180

11781181
<source><![CDATA[<!-- mybatis-config.xml -->
11791182
<objectFactory type="org.mybatis.example.ExampleObjectFactory">

src/site/ko/xdoc/configuration.xml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ public class Author {
665665
<code>ByteTypeHandler</code>
666666
</td>
667667
<td>
668-
<code>java.lang.Byte</code>, byte
668+
<code>java.lang.Byte</code>, <code>byte</code>
669669
</td>
670670
<td>어떤 호환가능한 NUMERIC 또는 BYTE</td>
671671
</tr>
@@ -701,7 +701,7 @@ public class Author {
701701
<code>FloatTypeHandler</code>
702702
</td>
703703
<td>
704-
<code>java.lang.Float</code>, float
704+
<code>java.lang.Float</code>, <code>float</code>
705705
</td>
706706
<td>어떤 호환가능한 NUMERIC 또는 FLOAT</td>
707707
</tr>
@@ -930,7 +930,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {
930930

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

10761079
<source><![CDATA[<!-- mybatis-config.xml -->
10771080
<objectFactory type="org.mybatis.example.ExampleObjectFactory">

src/site/xdoc/configuration.xml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ public class Author {
811811
<code>ByteTypeHandler</code>
812812
</td>
813813
<td>
814-
<code>java.lang.Byte</code>, byte
814+
<code>java.lang.Byte</code>, <code>byte</code>
815815
</td>
816816
<td>
817817
Any compatible <code>NUMERIC</code> or <code>BYTE</code>
@@ -855,7 +855,7 @@ public class Author {
855855
<code>FloatTypeHandler</code>
856856
</td>
857857
<td>
858-
<code>java.lang.Float</code>, float
858+
<code>java.lang.Float</code>, <code>float</code>
859859
</td>
860860
<td>
861861
Any compatible <code>NUMERIC</code> or <code>FLOAT</code>
@@ -1053,10 +1053,9 @@ public class Author {
10531053
</table>
10541054
<p>
10551055
You can override the type handlers or create your own to deal with
1056-
unsupported or non-standard types. To do so, simply extend
1057-
the
1058-
<code>org.apache.ibatis.type.BaseTypeHandler</code> class and optionally map your new
1059-
TypeHandler class to a JDBC type. For example:
1056+
unsupported or non-standard types. To do so, implement the interface <code>org.apache.ibatis.type.TypeHandler</code>
1057+
or extend the convenience class <code>org.apache.ibatis.type.BaseTypeHandler</code>
1058+
and optionally map it to a JDBC type. For example:
10601059
</p>
10611060

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

12761278
<source><![CDATA[<!-- mybatis-config.xml -->
12771279
<objectFactory type="org.mybatis.example.ExampleObjectFactory">

src/site/zh/xdoc/configuration.xml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ public class Author {
773773
<code>ByteTypeHandler</code>
774774
</td>
775775
<td>
776-
<code>java.lang.Byte</code>, byte
776+
<code>java.lang.Byte</code>, <code>byte</code>
777777
</td>
778778
<td>
779779
任何兼容的数字或字节类型
@@ -817,7 +817,7 @@ public class Author {
817817
<code>FloatTypeHandler</code>
818818
</td>
819819
<td>
820-
<code>java.lang.Float</code>, float
820+
<code>java.lang.Float</code>, <code>float</code>
821821
</td>
822822
<td>
823823
任何兼容的数字或单精度浮点型
@@ -1017,10 +1017,10 @@ public class Author {
10171017
<p>
10181018
你可以重写类型处理器或创建你自己的类型处理器来处理不支持的或非标准的类型。
10191019
//TODO translation needed
1020-
To do so, simply extend
1021-
the
1022-
<code>org.apache.ibatis.type.BaseTypeHandler</code> class and optionally map your new
1023-
<code>TypeHandler</code> class to a JDBC type. 例如:
1020+
1021+
To do so, implement the interface <code>org.apache.ibatis.type.TypeHandler</code>
1022+
or extend the convenience class <code>org.apache.ibatis.type.BaseTypeHandler</code>
1023+
and optionally map it to a JDBC type. 例如:
10241024
</p>
10251025
<source><![CDATA[// ExampleTypeHandler.java
10261026
@MappedJdbcTypes(JdbcType.VARCHAR)
@@ -1080,7 +1080,7 @@ public class ExampleTypeHandler extends BaseTypeHandler<String> {
10801080
<p>Associated JDBC type can be specified by two means:</p>
10811081
<ul>
10821082
<li>
1083-
Adding a <code>jdbcType</code> attribute to the typeHandler element (for example: <code>jdbcType=VARCHAR</code>).
1083+
Adding a <code>jdbcType</code> attribute to the typeHandler element (for example: <code>jdbcType="VARCHAR"</code>).
10841084
</li>
10851085
<li>Adding a <code>@MappedJdbcTypes</code> annotation to your TypeHandler class specifying
10861086
the list of JDBC types to associate it with. This annotation will be ignored if
@@ -1230,7 +1230,10 @@ public class ExampleObjectFactory extends DefaultObjectFactory {
12301230
public void setProperties(Properties properties) {
12311231
super.setProperties(properties);
12321232
}
1233-
}]]></source>
1233+
public <T> boolean isCollection(Class<T> type) {
1234+
return Collection.class.isAssignableFrom(type);
1235+
}}
1236+
]]></source>
12341237

12351238
<source><![CDATA[<!-- mybatis-config.xml -->
12361239
<objectFactory type="org.mybatis.example.ExampleObjectFactory">

src/test/java/org/apache/ibatis/type/TypeHandlerRegistryTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ public List<URI> getNullableResult( CallableStatement cs, int columnIndex )
122122
assertSame(fakeHandler, typeHandlerRegistry.getTypeHandler(new TypeReference<List<URI>>(){}));
123123
}
124124

125-
@Ignore("See https://github.com/mybatis/mybatis-3/issues/165")
125+
@Ignore("see https://github.com/mybatis/mybatis-3/issues/165")
126126
@Test
127-
public void registerWrapperHandlerBeforePrimitive() {
128-
129-
typeHandlerRegistry.register(int.class, DateTypeHandler.class);
127+
public void shouldBindHandlersToWrapersAndPrimitivesIndividually() {
128+
typeHandlerRegistry.register(Integer.class, DateTypeHandler.class);
129+
assertSame(IntegerTypeHandler.class, typeHandlerRegistry.getTypeHandler(int.class).getClass());
130130
typeHandlerRegistry.register(Integer.class, IntegerTypeHandler.class);
131-
131+
typeHandlerRegistry.register(int.class, DateTypeHandler.class);
132132
assertSame(IntegerTypeHandler.class, typeHandlerRegistry.getTypeHandler(Integer.class).getClass());
133-
assertSame(DateTypeHandler.class, typeHandlerRegistry.getTypeHandler(int.class).getClass());
133+
typeHandlerRegistry.register(Integer.class, IntegerTypeHandler.class);
134134
}
135135

136136
}

0 commit comments

Comments
 (0)