Skip to content

Commit b18e132

Browse files
committed
[ci] Move some overloaded methods around to comply with checkstyle order
1 parent 30d3496 commit b18e132

File tree

4 files changed

+155
-154
lines changed

4 files changed

+155
-154
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2019 the original author or authors.
2+
* Copyright 2009-2020 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.
@@ -325,10 +325,6 @@ public ResultHandler extractResultHandler(Object[] args) {
325325
return hasResultHandler() ? (ResultHandler) args[resultHandlerIndex] : null;
326326
}
327327

328-
public String getMapKey() {
329-
return mapKey;
330-
}
331-
332328
public Class<?> getReturnType() {
333329
return returnType;
334330
}
@@ -373,6 +369,10 @@ private Integer getUniqueParamIndex(Method method, Class<?> paramType) {
373369
return index;
374370
}
375371

372+
public String getMapKey() {
373+
return mapKey;
374+
}
375+
376376
private String getMapKey(Method method) {
377377
String mapKey = null;
378378
if (Map.class.isAssignableFrom(method.getReturnType())) {

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

Lines changed: 104 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,61 @@ public MappedStatement addMappedStatement(
298298
return statement;
299299
}
300300

301+
/**
302+
* Backward compatibility signature 'addMappedStatement'.
303+
*
304+
* @param id
305+
* the id
306+
* @param sqlSource
307+
* the sql source
308+
* @param statementType
309+
* the statement type
310+
* @param sqlCommandType
311+
* the sql command type
312+
* @param fetchSize
313+
* the fetch size
314+
* @param timeout
315+
* the timeout
316+
* @param parameterMap
317+
* the parameter map
318+
* @param parameterType
319+
* the parameter type
320+
* @param resultMap
321+
* the result map
322+
* @param resultType
323+
* the result type
324+
* @param resultSetType
325+
* the result set type
326+
* @param flushCache
327+
* the flush cache
328+
* @param useCache
329+
* the use cache
330+
* @param resultOrdered
331+
* the result ordered
332+
* @param keyGenerator
333+
* the key generator
334+
* @param keyProperty
335+
* the key property
336+
* @param keyColumn
337+
* the key column
338+
* @param databaseId
339+
* the database id
340+
* @param lang
341+
* the lang
342+
* @return the mapped statement
343+
*/
344+
public MappedStatement addMappedStatement(String id, SqlSource sqlSource, StatementType statementType,
345+
SqlCommandType sqlCommandType, Integer fetchSize, Integer timeout, String parameterMap, Class<?> parameterType,
346+
String resultMap, Class<?> resultType, ResultSetType resultSetType, boolean flushCache, boolean useCache,
347+
boolean resultOrdered, KeyGenerator keyGenerator, String keyProperty, String keyColumn, String databaseId,
348+
LanguageDriver lang) {
349+
return addMappedStatement(
350+
id, sqlSource, statementType, sqlCommandType, fetchSize, timeout,
351+
parameterMap, parameterType, resultMap, resultType, resultSetType,
352+
flushCache, useCache, resultOrdered, keyGenerator, keyProperty,
353+
keyColumn, databaseId, lang, null);
354+
}
355+
301356
private <T> T valueOrDefault(T value, T defaultValue) {
302357
return value == null ? defaultValue : value;
303358
}
@@ -391,6 +446,55 @@ public ResultMapping buildResultMapping(
391446
.build();
392447
}
393448

449+
450+
/**
451+
* Backward compatibility signature 'buildResultMapping'.
452+
*
453+
* @param resultType
454+
* the result type
455+
* @param property
456+
* the property
457+
* @param column
458+
* the column
459+
* @param javaType
460+
* the java type
461+
* @param jdbcType
462+
* the jdbc type
463+
* @param nestedSelect
464+
* the nested select
465+
* @param nestedResultMap
466+
* the nested result map
467+
* @param notNullColumn
468+
* the not null column
469+
* @param columnPrefix
470+
* the column prefix
471+
* @param typeHandler
472+
* the type handler
473+
* @param flags
474+
* the flags
475+
* @return the result mapping
476+
*/
477+
public ResultMapping buildResultMapping(Class<?> resultType, String property, String column, Class<?> javaType,
478+
JdbcType jdbcType, String nestedSelect, String nestedResultMap, String notNullColumn, String columnPrefix,
479+
Class<? extends TypeHandler<?>> typeHandler, List<ResultFlag> flags) {
480+
return buildResultMapping(
481+
resultType, property, column, javaType, jdbcType, nestedSelect,
482+
nestedResultMap, notNullColumn, columnPrefix, typeHandler, flags, null, null, configuration.isLazyLoadingEnabled());
483+
}
484+
485+
/**
486+
* Gets the language driver.
487+
*
488+
* @param langClass
489+
* the lang class
490+
* @return the language driver
491+
* @deprecated Use {@link Configuration#getLanguageDriver(Class)}
492+
*/
493+
@Deprecated
494+
public LanguageDriver getLanguageDriver(Class<? extends LanguageDriver> langClass) {
495+
return configuration.getLanguageDriver(langClass);
496+
}
497+
394498
private Set<String> parseMultipleColumnNames(String columnName) {
395499
Set<String> columns = new HashSet<>();
396500
if (columnName != null) {
@@ -454,107 +558,4 @@ private Class<?> resolveParameterJavaType(Class<?> resultType, String property,
454558
return javaType;
455559
}
456560

457-
/**
458-
* Backward compatibility signature 'buildResultMapping'.
459-
*
460-
* @param resultType
461-
* the result type
462-
* @param property
463-
* the property
464-
* @param column
465-
* the column
466-
* @param javaType
467-
* the java type
468-
* @param jdbcType
469-
* the jdbc type
470-
* @param nestedSelect
471-
* the nested select
472-
* @param nestedResultMap
473-
* the nested result map
474-
* @param notNullColumn
475-
* the not null column
476-
* @param columnPrefix
477-
* the column prefix
478-
* @param typeHandler
479-
* the type handler
480-
* @param flags
481-
* the flags
482-
* @return the result mapping
483-
*/
484-
public ResultMapping buildResultMapping(Class<?> resultType, String property, String column, Class<?> javaType,
485-
JdbcType jdbcType, String nestedSelect, String nestedResultMap, String notNullColumn, String columnPrefix,
486-
Class<? extends TypeHandler<?>> typeHandler, List<ResultFlag> flags) {
487-
return buildResultMapping(
488-
resultType, property, column, javaType, jdbcType, nestedSelect,
489-
nestedResultMap, notNullColumn, columnPrefix, typeHandler, flags, null, null, configuration.isLazyLoadingEnabled());
490-
}
491-
492-
/**
493-
* Gets the language driver.
494-
*
495-
* @param langClass
496-
* the lang class
497-
* @return the language driver
498-
* @deprecated Use {@link Configuration#getLanguageDriver(Class)}
499-
*/
500-
@Deprecated
501-
public LanguageDriver getLanguageDriver(Class<? extends LanguageDriver> langClass) {
502-
return configuration.getLanguageDriver(langClass);
503-
}
504-
505-
/**
506-
* Backward compatibility signature 'addMappedStatement'.
507-
*
508-
* @param id
509-
* the id
510-
* @param sqlSource
511-
* the sql source
512-
* @param statementType
513-
* the statement type
514-
* @param sqlCommandType
515-
* the sql command type
516-
* @param fetchSize
517-
* the fetch size
518-
* @param timeout
519-
* the timeout
520-
* @param parameterMap
521-
* the parameter map
522-
* @param parameterType
523-
* the parameter type
524-
* @param resultMap
525-
* the result map
526-
* @param resultType
527-
* the result type
528-
* @param resultSetType
529-
* the result set type
530-
* @param flushCache
531-
* the flush cache
532-
* @param useCache
533-
* the use cache
534-
* @param resultOrdered
535-
* the result ordered
536-
* @param keyGenerator
537-
* the key generator
538-
* @param keyProperty
539-
* the key property
540-
* @param keyColumn
541-
* the key column
542-
* @param databaseId
543-
* the database id
544-
* @param lang
545-
* the lang
546-
* @return the mapped statement
547-
*/
548-
public MappedStatement addMappedStatement(String id, SqlSource sqlSource, StatementType statementType,
549-
SqlCommandType sqlCommandType, Integer fetchSize, Integer timeout, String parameterMap, Class<?> parameterType,
550-
String resultMap, Class<?> resultType, ResultSetType resultSetType, boolean flushCache, boolean useCache,
551-
boolean resultOrdered, KeyGenerator keyGenerator, String keyProperty, String keyColumn, String databaseId,
552-
LanguageDriver lang) {
553-
return addMappedStatement(
554-
id, sqlSource, statementType, sqlCommandType, fetchSize, timeout,
555-
parameterMap, parameterType, resultMap, resultType, resultSetType,
556-
flushCache, useCache, resultOrdered, keyGenerator, keyProperty,
557-
keyColumn, databaseId, lang, null);
558-
}
559-
560561
}

src/main/java/org/apache/ibatis/executor/CachingExecutor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2019 the original author or authors.
2+
* Copyright 2009-2020 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.
@@ -76,19 +76,19 @@ public int update(MappedStatement ms, Object parameterObject) throws SQLExceptio
7676
return delegate.update(ms, parameterObject);
7777
}
7878

79+
@Override
80+
public <E> Cursor<E> queryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds) throws SQLException {
81+
flushCacheIfRequired(ms);
82+
return delegate.queryCursor(ms, parameter, rowBounds);
83+
}
84+
7985
@Override
8086
public <E> List<E> query(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException {
8187
BoundSql boundSql = ms.getBoundSql(parameterObject);
8288
CacheKey key = createCacheKey(ms, parameterObject, rowBounds, boundSql);
8389
return query(ms, parameterObject, rowBounds, resultHandler, key, boundSql);
8490
}
8591

86-
@Override
87-
public <E> Cursor<E> queryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds) throws SQLException {
88-
flushCacheIfRequired(ms);
89-
return delegate.queryCursor(ms, parameter, rowBounds);
90-
}
91-
9292
@Override
9393
public <E> List<E> query(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler, CacheKey key, BoundSql boundSql)
9494
throws SQLException {

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,45 @@ private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, String col
408408
return rowValue;
409409
}
410410

411+
//
412+
// GET VALUE FROM ROW FOR NESTED RESULT MAP
413+
//
414+
415+
private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, CacheKey combinedKey, String columnPrefix, Object partialObject) throws SQLException {
416+
final String resultMapId = resultMap.getId();
417+
Object rowValue = partialObject;
418+
if (rowValue != null) {
419+
final MetaObject metaObject = configuration.newMetaObject(rowValue);
420+
putAncestor(rowValue, resultMapId);
421+
applyNestedResultMappings(rsw, resultMap, metaObject, columnPrefix, combinedKey, false);
422+
ancestorObjects.remove(resultMapId);
423+
} else {
424+
final ResultLoaderMap lazyLoader = new ResultLoaderMap();
425+
rowValue = createResultObject(rsw, resultMap, lazyLoader, columnPrefix);
426+
if (rowValue != null && !hasTypeHandlerForResultObject(rsw, resultMap.getType())) {
427+
final MetaObject metaObject = configuration.newMetaObject(rowValue);
428+
boolean foundValues = this.useConstructorMappings;
429+
if (shouldApplyAutomaticMappings(resultMap, true)) {
430+
foundValues = applyAutomaticMappings(rsw, resultMap, metaObject, columnPrefix) || foundValues;
431+
}
432+
foundValues = applyPropertyMappings(rsw, resultMap, metaObject, lazyLoader, columnPrefix) || foundValues;
433+
putAncestor(rowValue, resultMapId);
434+
foundValues = applyNestedResultMappings(rsw, resultMap, metaObject, columnPrefix, combinedKey, true) || foundValues;
435+
ancestorObjects.remove(resultMapId);
436+
foundValues = lazyLoader.size() > 0 || foundValues;
437+
rowValue = foundValues || configuration.isReturnInstanceForEmptyRow() ? rowValue : null;
438+
}
439+
if (combinedKey != CacheKey.NULL_CACHE_KEY) {
440+
nestedResultObjects.put(combinedKey, rowValue);
441+
}
442+
}
443+
return rowValue;
444+
}
445+
446+
private void putAncestor(Object resultObject, String resultMapId) {
447+
ancestorObjects.put(resultMapId, resultObject);
448+
}
449+
411450
private boolean shouldApplyAutomaticMappings(ResultMap resultMap, boolean isNested) {
412451
if (resultMap.getAutoMapping() != null) {
413452
return resultMap.getAutoMapping();
@@ -881,45 +920,6 @@ private void handleRowValuesForNestedResultMap(ResultSetWrapper rsw, ResultMap r
881920
}
882921
}
883922

884-
//
885-
// GET VALUE FROM ROW FOR NESTED RESULT MAP
886-
//
887-
888-
private Object getRowValue(ResultSetWrapper rsw, ResultMap resultMap, CacheKey combinedKey, String columnPrefix, Object partialObject) throws SQLException {
889-
final String resultMapId = resultMap.getId();
890-
Object rowValue = partialObject;
891-
if (rowValue != null) {
892-
final MetaObject metaObject = configuration.newMetaObject(rowValue);
893-
putAncestor(rowValue, resultMapId);
894-
applyNestedResultMappings(rsw, resultMap, metaObject, columnPrefix, combinedKey, false);
895-
ancestorObjects.remove(resultMapId);
896-
} else {
897-
final ResultLoaderMap lazyLoader = new ResultLoaderMap();
898-
rowValue = createResultObject(rsw, resultMap, lazyLoader, columnPrefix);
899-
if (rowValue != null && !hasTypeHandlerForResultObject(rsw, resultMap.getType())) {
900-
final MetaObject metaObject = configuration.newMetaObject(rowValue);
901-
boolean foundValues = this.useConstructorMappings;
902-
if (shouldApplyAutomaticMappings(resultMap, true)) {
903-
foundValues = applyAutomaticMappings(rsw, resultMap, metaObject, columnPrefix) || foundValues;
904-
}
905-
foundValues = applyPropertyMappings(rsw, resultMap, metaObject, lazyLoader, columnPrefix) || foundValues;
906-
putAncestor(rowValue, resultMapId);
907-
foundValues = applyNestedResultMappings(rsw, resultMap, metaObject, columnPrefix, combinedKey, true) || foundValues;
908-
ancestorObjects.remove(resultMapId);
909-
foundValues = lazyLoader.size() > 0 || foundValues;
910-
rowValue = foundValues || configuration.isReturnInstanceForEmptyRow() ? rowValue : null;
911-
}
912-
if (combinedKey != CacheKey.NULL_CACHE_KEY) {
913-
nestedResultObjects.put(combinedKey, rowValue);
914-
}
915-
}
916-
return rowValue;
917-
}
918-
919-
private void putAncestor(Object resultObject, String resultMapId) {
920-
ancestorObjects.put(resultMapId, resultObject);
921-
}
922-
923923
//
924924
// NESTED RESULT MAP (JOIN MAPPING)
925925
//

0 commit comments

Comments
 (0)