Package org.apache.ibatis.reflection
Class ParamNameResolver
java.lang.Object
org.apache.ibatis.reflection.ParamNameResolver
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringgetActualParamName(Method method, int paramIndex) getNamedParams(Object[] args) A single non-special parameter is returned without a name.String[]getNames()Returns parameter names referenced by SQL providers.private static booleanisSpecialParameter(Class<?> clazz) static ObjectwrapToMapIfCollection(Object object, String actualParamName) Wrap to aMapperMethod.ParamMapif object isCollectionor array.
-
Field Details
-
GENERIC_NAME_PREFIX
- See Also:
-
useActualParamName
private final boolean useActualParamName -
names
The key is the index and the value is the name of the parameter.
The name is obtained fromParamif specified. WhenParamis not specified, the parameter index is used. Note that this index could be different from the actual index when the method has special parameters (i.e.RowBoundsorResultHandler).- aMethod(@Param("M") int a, @Param("N") int b) -> {{0, "M"}, {1, "N"}}
- aMethod(int a, int b) -> {{0, "0"}, {1, "1"}}
- aMethod(int a, RowBounds rb, int b) -> {{0, "0"}, {2, "1"}}
-
hasParamAnnotation
private boolean hasParamAnnotation
-
-
Constructor Details
-
ParamNameResolver
-
-
Method Details
-
getActualParamName
-
isSpecialParameter
-
getNames
Returns parameter names referenced by SQL providers.- Returns:
- the names
-
getNamedParams
A single non-special parameter is returned without a name. Multiple parameters are named using the naming rule. In addition to the default names, this method also adds the generic names (param1, param2, ...).
- Parameters:
args- the args- Returns:
- the named params
-
wrapToMapIfCollection
Wrap to aMapperMethod.ParamMapif object isCollectionor array.- Parameters:
object- a parameter objectactualParamName- an actual parameter name (If specify a name, set an object toMapperMethod.ParamMapwith specified name)- Returns:
- a
MapperMethod.ParamMap - Since:
- 3.5.5
-