Skip to content

Commit ce14cec

Browse files
committed
Polishing how to refers the useActualParamName on ParamNameResolver
Related with gh-1237
1 parent 7d1191b commit ce14cec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/org/apache/ibatis/reflection/ParamNameResolver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class ParamNameResolver {
3535

3636
public static final String GENERIC_NAME_PREFIX = "param";
3737

38+
private final boolean useActualParamName;
39+
3840
/**
3941
* <p>
4042
* The key is the index and the value is the name of the parameter.<br />
@@ -51,9 +53,9 @@ public class ParamNameResolver {
5153
private final SortedMap<Integer, String> names;
5254

5355
private boolean hasParamAnnotation;
54-
private boolean useActualParamName;
5556

5657
public ParamNameResolver(Configuration config, Method method) {
58+
this.useActualParamName = config.isUseActualParamName();
5759
final Class<?>[] paramTypes = method.getParameterTypes();
5860
final Annotation[][] paramAnnotations = method.getParameterAnnotations();
5961
final SortedMap<Integer, String> map = new TreeMap<>();
@@ -74,15 +76,13 @@ public ParamNameResolver(Configuration config, Method method) {
7476
}
7577
if (name == null) {
7678
// @Param was not specified.
77-
if (config.isUseActualParamName()) {
79+
if (useActualParamName) {
7880
name = getActualParamName(method, paramIndex);
7981
}
8082
if (name == null) {
8183
// use the parameter index as the name ("0", "1", ...)
8284
// gcode issue #71
8385
name = String.valueOf(map.size());
84-
} else {
85-
useActualParamName = true;
8686
}
8787
}
8888
map.put(paramIndex, name);

0 commit comments

Comments
 (0)