Polishing
This commit is contained in:
@@ -105,7 +105,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||
}
|
||||
else {
|
||||
return (this.prefix.endsWith("/") || path.startsWith("/") ?
|
||||
this.prefix + path : this.prefix + "/" + path);
|
||||
this.prefix + path : this.prefix + '/' + path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||
Matcher matcher = pattern.matcher(requestPath);
|
||||
if (matcher.find()) {
|
||||
String match = matcher.group(1);
|
||||
return (match.contains("-") ? match.substring(match.lastIndexOf("-") + 1) : match);
|
||||
return (match.contains("-") ? match.substring(match.lastIndexOf('-') + 1) : match);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
@@ -140,7 +140,7 @@ public abstract class AbstractVersionStrategy implements VersionStrategy {
|
||||
public String addVersion(String requestPath, String version) {
|
||||
String baseFilename = StringUtils.stripFilenameExtension(requestPath);
|
||||
String extension = StringUtils.getFilenameExtension(requestPath);
|
||||
return (baseFilename + "-" + version + "." + extension);
|
||||
return (baseFilename + '-' + version + '.' + extension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ import org.springframework.core.GenericTypeResolver;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.reactive.HandlerResult;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
|
||||
/**
|
||||
* Extension of HandlerMethod that can invoke the target method after resolving
|
||||
* its method arguments.
|
||||
@@ -160,22 +160,22 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
|
||||
private String getDetailedErrorMessage(String message, MethodParameter param) {
|
||||
StringBuilder sb = new StringBuilder(message);
|
||||
sb.append("argument [" + param.getParameterIndex() + "] ");
|
||||
sb.append("of type [" + param.getParameterType().getName() + "] ");
|
||||
sb.append("on method [" + getBridgedMethod().toGenericString() + "]");
|
||||
sb.append("argument [").append(param.getParameterIndex()).append("] ");
|
||||
sb.append("of type [").append(param.getParameterType().getName()).append("] ");
|
||||
sb.append("on method [").append(getBridgedMethod().toGenericString()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Object doInvoke(Object[] args) throws Exception {
|
||||
if (logger.isTraceEnabled()) {
|
||||
String target = getBeanType().getSimpleName() + "." + getMethod().getName();
|
||||
logger.trace("Invoking [" + target + "] method with arguments " + Arrays.toString(args));
|
||||
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"' with arguments " + Arrays.toString(args));
|
||||
}
|
||||
ReflectionUtils.makeAccessible(getBridgedMethod());
|
||||
Object returnValue = getBridgedMethod().invoke(getBean(), args);
|
||||
if (logger.isTraceEnabled()) {
|
||||
String target = getBeanType().getSimpleName() + "." + getMethod().getName();
|
||||
logger.trace("Method [" + target + "] returned [" + returnValue + "]");
|
||||
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
|
||||
"] returned [" + returnValue + "]");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user