cc.shacocloud.mirage.web.bind.support.PathVariableMethodArgumentResolver Maven / Gradle / Ivy
package cc.shacocloud.mirage.web.bind.support;
import cc.shacocloud.mirage.utils.Utils;
import cc.shacocloud.mirage.web.HttpRequest;
import cc.shacocloud.mirage.web.bind.annotation.PathVariable;
import cc.shacocloud.mirage.web.bind.ValueConstants;
import io.vertx.core.Future;
import org.springframework.core.MethodParameter;
import org.springframework.util.StringUtils;
/**
* 解析{@link PathVariable} 注解的方法参数
*/
public class PathVariableMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver {
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(PathVariable.class);
}
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
PathVariable ann = parameter.getParameterAnnotation(PathVariable.class);
if (ann != null) return new PathVariableNamedValueInfo(ann);
throw new IllegalStateException("不支持处理当前方法,请先执行 supportsParameter 方法进行判断:" + Utils.methodDescription(parameter.getDeclaringClass(), parameter.getMethod()));
}
@Override
protected String resolveStringValue(String value) {
return value;
}
@Override
protected Future
© 2015 - 2025 Weber Informatics LLC | Privacy Policy