File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/main/java/org/apache/ibatis/reflection Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2009-2023 the original author or authors.
2
+ * Copyright 2009-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -35,6 +35,14 @@ public class ParamNameResolver {
35
35
36
36
public static final String GENERIC_NAME_PREFIX = "param" ;
37
37
38
+ public static final String [] GENERIC_NAME_CACHE = new String [10 ];
39
+
40
+ static {
41
+ for (int i = 0 ; i < 10 ; i ++) {
42
+ GENERIC_NAME_CACHE [i ] = GENERIC_NAME_PREFIX + (i + 1 );
43
+ }
44
+ }
45
+
38
46
private final boolean useActualParamName ;
39
47
40
48
/**
@@ -132,7 +140,7 @@ public Object getNamedParams(Object[] args) {
132
140
for (Map .Entry <Integer , String > entry : names .entrySet ()) {
133
141
param .put (entry .getValue (), args [entry .getKey ()]);
134
142
// add generic param names (param1, param2, ...)
135
- final String genericParamName = GENERIC_NAME_PREFIX + (i + 1 );
143
+ final String genericParamName = i < 10 ? GENERIC_NAME_CACHE [ i ] : GENERIC_NAME_PREFIX + (i + 1 );
136
144
// ensure not to overwrite parameter named with @Param
137
145
if (!names .containsValue (genericParamName )) {
138
146
param .put (genericParamName , args [entry .getKey ()]);
You can’t perform that action at this time.
0 commit comments