ClassUtils.forName("javax.validation.ParameterNameProvider", getClass().getClassLoader());
Method parameterNameProviderMethod =
Configuration.class.getMethod("parameterNameProvider", parameterNameProviderClass);
final Object defaultProvider = ReflectionUtils.invokeMethod(
Configuration.class.getMethod("getDefaultParameterNameProvider"), configuration);
final ParameterNameDiscoverer discoverer = this.parameterNameDiscoverer;
Object parameterNameProvider = Proxy.newProxyInstance(getClass().getClassLoader(),
new Class<?>[] {parameterNameProviderClass}, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().equals("getParameterNames")) {
String[] result = null;
if (args[0] instanceof Constructor) {
result = discoverer.getParameterNames((Constructor<?>) args[0]);
}
else if (args[0] instanceof Method) {
result = discoverer.getParameterNames((Method) args[0]);
}
if (result != null) {
return Arrays.asList(result);
}
else {