Skip to content

Commit 9efaadd

Browse files
authored
Merge pull request #1456 from hazendaz/master
Working checkstyle issues
2 parents 33d0793 + d0e3041 commit 9efaadd

27 files changed

+154
-146
lines changed

src/main/java/org/apache/ibatis/annotations/CacheNamespaceRef.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@
3333
@Retention(RetentionPolicy.RUNTIME)
3434
@Target(ElementType.TYPE)
3535
public @interface CacheNamespaceRef {
36+
3637
/**
37-
* A namespace type to reference a cache (the namespace name become a FQCN of specified type)
38+
* A namespace type to reference a cache (the namespace name become a FQCN of specified type).
3839
*/
3940
Class<?> value() default void.class;
41+
4042
/**
41-
* A namespace name to reference a cache
43+
* A namespace name to reference a cache.
4244
* @since 3.4.2
4345
*/
4446
String name() default "";

src/main/java/org/apache/ibatis/annotations/Lang.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
*/
1616
package org.apache.ibatis.annotations;
1717

18-
import org.apache.ibatis.scripting.LanguageDriver;
19-
2018
import java.lang.annotation.Documented;
2119
import java.lang.annotation.ElementType;
2220
import java.lang.annotation.Retention;
2321
import java.lang.annotation.RetentionPolicy;
2422
import java.lang.annotation.Target;
2523

24+
import org.apache.ibatis.scripting.LanguageDriver;
25+
2626
/**
2727
* @author Clinton Begin
2828
*/

src/main/java/org/apache/ibatis/annotations/Mapper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717

1818
import java.lang.annotation.Documented;
1919
import java.lang.annotation.ElementType;
20-
import java.lang.annotation.RetentionPolicy;
21-
2220
import java.lang.annotation.Inherited;
2321
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
2423
import java.lang.annotation.Target;
2524

2625
/**

src/main/java/org/apache/ibatis/annotations/Property.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
@Retention(RetentionPolicy.RUNTIME)
3232
@Target({})
3333
public @interface Property {
34+
3435
/**
35-
* A target property name
36+
* A target property name.
3637
*/
3738
String name();
39+
3840
/**
39-
* A property value or placeholder
41+
* A property value or placeholder.
4042
*/
4143
String value();
4244
}

src/main/java/org/apache/ibatis/binding/MapperMethod.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private <E> Object convertToArray(List<E> list) {
184184
for (int i = 0; i < list.size(); i++) {
185185
Array.set(array, i, list.get(i));
186186
}
187-
return array;
187+
return array;
188188
} else {
189189
return list.toArray((E[])array);
190190
}
@@ -350,7 +350,7 @@ public boolean returnsCursor() {
350350
}
351351

352352
/**
353-
* return whether return type is {@code java.util.Optional}
353+
* return whether return type is {@code java.util.Optional}.
354354
* @return return {@code true}, if return type is {@code java.util.Optional}
355355
* @since 3.5.0
356356
*/

src/main/java/org/apache/ibatis/builder/BaseBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2018 the original author or authors.
2+
* Copyright 2009-2019 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.

src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ private void objectWrapperFactoryElement(XNode context) throws Exception {
212212

213213
private void reflectorFactoryElement(XNode context) throws Exception {
214214
if (context != null) {
215-
String type = context.getStringAttribute("type");
216-
ReflectorFactory factory = (ReflectorFactory) resolveClass(type).newInstance();
217-
configuration.setReflectorFactory(factory);
215+
String type = context.getStringAttribute("type");
216+
ReflectorFactory factory = (ReflectorFactory) resolveClass(type).newInstance();
217+
configuration.setReflectorFactory(factory);
218218
}
219219
}
220220

@@ -294,7 +294,7 @@ private void databaseIdProviderElement(XNode context) throws Exception {
294294
String type = context.getStringAttribute("type");
295295
// awful patch to keep backward compatibility
296296
if ("VENDOR".equals(type)) {
297-
type = "DB_VENDOR";
297+
type = "DB_VENDOR";
298298
}
299299
Properties properties = context.getChildrenAsProperties();
300300
databaseIdProvider = (DatabaseIdProvider) resolveClass(type).newInstance();

src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,10 @@ private ResultMap resultMapElement(XNode resultMapNode) throws Exception {
255255

256256
private ResultMap resultMapElement(XNode resultMapNode, List<ResultMapping> additionalResultMappings, Class<?> enclosingType) throws Exception {
257257
ErrorContext.instance().activity("processing " + resultMapNode.getValueBasedIdentifier());
258-
String id = resultMapNode.getStringAttribute("id",
259-
resultMapNode.getValueBasedIdentifier());
260258
String type = resultMapNode.getStringAttribute("type",
261259
resultMapNode.getStringAttribute("ofType",
262260
resultMapNode.getStringAttribute("resultType",
263261
resultMapNode.getStringAttribute("javaType"))));
264-
String extend = resultMapNode.getStringAttribute("extends");
265-
Boolean autoMapping = resultMapNode.getBooleanAttribute("autoMapping");
266262
Class<?> typeClass = resolveClass(type);
267263
if (typeClass == null) {
268264
typeClass = inheritEnclosingType(resultMapNode, enclosingType);
@@ -284,6 +280,10 @@ private ResultMap resultMapElement(XNode resultMapNode, List<ResultMapping> addi
284280
resultMappings.add(buildResultMappingFromContext(resultChild, typeClass, flags));
285281
}
286282
}
283+
String id = resultMapNode.getStringAttribute("id",
284+
resultMapNode.getValueBasedIdentifier());
285+
String extend = resultMapNode.getStringAttribute("extends");
286+
Boolean autoMapping = resultMapNode.getBooleanAttribute("autoMapping");
287287
ResultMapResolver resultMapResolver = new ResultMapResolver(builderAssistant, id, typeClass, extend, discriminator, resultMappings, autoMapping);
288288
try {
289289
return resultMapResolver.resolve();
@@ -413,7 +413,7 @@ private String processNestedResultMappings(XNode context, List<ResultMapping> re
413413

414414
protected void validateCollection(XNode context, Class<?> enclosingType) {
415415
if ("collection".equals(context.getName()) && context.getStringAttribute("resultMap") == null
416-
&& context.getStringAttribute("resultType") == null) {
416+
&& context.getStringAttribute("resultType") == null) {
417417
MetaClass metaResultType = MetaClass.forClass(enclosingType, configuration.getReflectorFactory());
418418
String property = context.getStringAttribute("property");
419419
if (!metaResultType.hasSetter(property)) {

src/main/java/org/apache/ibatis/builder/xml/XMLMapperEntityResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.xml.sax.SAXException;
2626

2727
/**
28-
* Offline entity resolver for the MyBatis DTDs
28+
* Offline entity resolver for the MyBatis DTDs.
2929
*
3030
* @author Clinton Begin
3131
* @author Eduardo Macarron
@@ -41,7 +41,7 @@ public class XMLMapperEntityResolver implements EntityResolver {
4141
private static final String MYBATIS_MAPPER_DTD = "org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd";
4242

4343
/**
44-
* Converts a public DTD into a local one
44+
* Converts a public DTD into a local one.
4545
*
4646
* @param publicId The public id that is what comes after "PUBLIC"
4747
* @param systemId The system id that is what comes after the public id.

src/main/java/org/apache/ibatis/builder/xml/XMLStatementBuilder.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,6 @@ public void parseStatementNode() {
6161
return;
6262
}
6363

64-
Integer fetchSize = context.getIntAttribute("fetchSize");
65-
Integer timeout = context.getIntAttribute("timeout");
66-
String parameterMap = context.getStringAttribute("parameterMap");
67-
String parameterType = context.getStringAttribute("parameterType");
68-
Class<?> parameterTypeClass = resolveClass(parameterType);
69-
String resultMap = context.getStringAttribute("resultMap");
70-
String resultType = context.getStringAttribute("resultType");
71-
String lang = context.getStringAttribute("lang");
72-
LanguageDriver langDriver = getLanguageDriver(lang);
73-
74-
Class<?> resultTypeClass = resolveClass(resultType);
75-
String resultSetType = context.getStringAttribute("resultSetType");
76-
StatementType statementType = StatementType.valueOf(context.getStringAttribute("statementType", StatementType.PREPARED.toString()));
77-
ResultSetType resultSetTypeEnum = resolveResultSetType(resultSetType);
78-
7964
String nodeName = context.getNode().getNodeName();
8065
SqlCommandType sqlCommandType = SqlCommandType.valueOf(nodeName.toUpperCase(Locale.ENGLISH));
8166
boolean isSelect = sqlCommandType == SqlCommandType.SELECT;
@@ -87,14 +72,16 @@ public void parseStatementNode() {
8772
XMLIncludeTransformer includeParser = new XMLIncludeTransformer(configuration, builderAssistant);
8873
includeParser.applyIncludes(context.getNode());
8974

75+
String parameterType = context.getStringAttribute("parameterType");
76+
Class<?> parameterTypeClass = resolveClass(parameterType);
77+
78+
String lang = context.getStringAttribute("lang");
79+
LanguageDriver langDriver = getLanguageDriver(lang);
80+
9081
// Parse selectKey after includes and remove them.
9182
processSelectKeyNodes(id, parameterTypeClass, langDriver);
9283

9384
// Parse the SQL (pre: <selectKey> and <include> were parsed and removed)
94-
SqlSource sqlSource = langDriver.createSqlSource(configuration, context, parameterTypeClass);
95-
String resultSets = context.getStringAttribute("resultSets");
96-
String keyProperty = context.getStringAttribute("keyProperty");
97-
String keyColumn = context.getStringAttribute("keyColumn");
9885
KeyGenerator keyGenerator;
9986
String keyStatementId = id + SelectKeyGenerator.SELECT_KEY_SUFFIX;
10087
keyStatementId = builderAssistant.applyCurrentNamespace(keyStatementId, true);
@@ -106,6 +93,20 @@ public void parseStatementNode() {
10693
? Jdbc3KeyGenerator.INSTANCE : NoKeyGenerator.INSTANCE;
10794
}
10895

96+
SqlSource sqlSource = langDriver.createSqlSource(configuration, context, parameterTypeClass);
97+
StatementType statementType = StatementType.valueOf(context.getStringAttribute("statementType", StatementType.PREPARED.toString()));
98+
Integer fetchSize = context.getIntAttribute("fetchSize");
99+
Integer timeout = context.getIntAttribute("timeout");
100+
String parameterMap = context.getStringAttribute("parameterMap");
101+
String resultType = context.getStringAttribute("resultType");
102+
Class<?> resultTypeClass = resolveClass(resultType);
103+
String resultMap = context.getStringAttribute("resultMap");
104+
String resultSetType = context.getStringAttribute("resultSetType");
105+
ResultSetType resultSetTypeEnum = resolveResultSetType(resultSetType);
106+
String keyProperty = context.getStringAttribute("keyProperty");
107+
String keyColumn = context.getStringAttribute("keyColumn");
108+
String resultSets = context.getStringAttribute("resultSets");
109+
109110
builderAssistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType,
110111
fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass,
111112
resultSetTypeEnum, flushCache, useCache, resultOrdered,

0 commit comments

Comments
 (0)