name ( )源码实例Demo

org.springframework.web.bind.annotation.DeleteMapping#name ( )源码实例Demo

下面列出了org.springframework.web.bind.annotation.DeleteMapping#name ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

private String resolveApiName(OperationContext context) {
	Api api = context.findControllerAnnotation(Api.class).orNull();
	if (api != null) {
		return api.tags()[0];
	}
	GetMapping getMapping = context.findControllerAnnotation(GetMapping.class).orNull();
	if (getMapping != null) {
		return getMapping.name();
	}
	PostMapping postMapping = context.findControllerAnnotation(PostMapping.class).orNull();
	if (postMapping != null) {
		return postMapping.name();
	}
	DeleteMapping deleteMapping = context.findControllerAnnotation(DeleteMapping.class).orNull();
	if (deleteMapping != null) {
		return deleteMapping.name();
	}
	PutMapping putMapping = context.findControllerAnnotation(PutMapping.class).orNull();
	if (putMapping != null) {
		return putMapping.name();
	}
	RequestMapping requestMapping = context.findControllerAnnotation(RequestMapping.class).orNull();
	if (requestMapping != null) {
		return requestMapping.name();
	}
	return "";
}
 
private ControllerInfo resolveNameAttribute(Class<?> controller) {
	ControllerInfo info = new ControllerInfo();
	boolean isRestController = isRestController(controller);
	GetMapping getMapping = findAnnotation(controller, GetMapping.class);
	if (getMapping != null) {
		info.name = getMapping.name();
		info.consumes = getMapping.consumes();
		info.produces = resolveJsonInfo(isRestController, getMapping.produces());
		return info;
	}
	PostMapping postMapping = findAnnotation(controller, PostMapping.class);
	if (postMapping != null) {
		info.name = postMapping.name();
		info.consumes = postMapping.consumes();
		info.produces = resolveJsonInfo(isRestController, postMapping.produces());
		return info;
	}
	DeleteMapping deleteMapping = findAnnotation(controller, DeleteMapping.class);
	if (deleteMapping != null) {
		info.name = deleteMapping.name();
		info.consumes = deleteMapping.consumes();
		info.produces = resolveJsonInfo(isRestController, deleteMapping.produces());
		return info;
	}
	PutMapping putMapping = findAnnotation(controller, PutMapping.class);
	if (putMapping != null) {
		info.name = putMapping.name();
		info.consumes = putMapping.consumes();
		info.produces = resolveJsonInfo(isRestController, putMapping.produces());
		return info;
	}
	RequestMapping requestMapping = findAnnotation(controller, RequestMapping.class);
	if (requestMapping != null) {
		info.name = requestMapping.name();
		info.consumes = requestMapping.consumes();
		info.produces = resolveJsonInfo(isRestController, requestMapping.produces());
		return info;
	}
	return null;
}
 
private EndPointInfo resolveNameAttribute(OperationContext context) {
	EndPointInfo info = new EndPointInfo();
	info.controllerName = resolveApiName(context);
	boolean isRestEndPoint = isRestEndPoint(context);
	GetMapping getMapping = context.findAnnotation(GetMapping.class).orNull();
	if (getMapping != null) {
		info.name = getMapping.name();
		info.consumes = getMapping.consumes();
		info.produces = resolveJsonInfo(isRestEndPoint, getMapping.produces());
		return info;
	}
	PostMapping postMapping = context.findAnnotation(PostMapping.class).orNull();
	if (postMapping != null) {
		info.name = postMapping.name();
		info.consumes = postMapping.consumes();
		info.produces = resolveJsonInfo(isRestEndPoint, postMapping.produces());
		return info;
	}
	DeleteMapping deleteMapping = context.findAnnotation(DeleteMapping.class).orNull();
	if (deleteMapping != null) {
		info.name = deleteMapping.name();
		info.consumes = deleteMapping.consumes();
		info.produces = resolveJsonInfo(isRestEndPoint, deleteMapping.produces());
		return info;
	}
	PutMapping putMapping = context.findAnnotation(PutMapping.class).orNull();
	if (putMapping != null) {
		info.name = putMapping.name();
		info.consumes = putMapping.consumes();
		info.produces = resolveJsonInfo(isRestEndPoint, putMapping.produces());
		return info;
	}
	RequestMapping requestMapping = context.findAnnotation(RequestMapping.class).orNull();
	if (requestMapping != null) {
		info.name = requestMapping.name();
		info.consumes = requestMapping.consumes();
		info.produces = resolveJsonInfo(isRestEndPoint, requestMapping.produces());
		return info;
	}
	return null;
}
 
服务器费用不足...
 同类方法
支付宝打赏 微信打赏

如果文章对你有帮助,欢迎点击上方按钮打赏作者