下面列出了org.springframework.core.codec.Hints# none ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
protected Map<String, Object> getHints(ResolvableType resolvableType) {
MethodParameter param = getParameter(resolvableType);
if (param != null) {
JsonView annotation = getAnnotation(param, JsonView.class);
if (annotation != null) {
Class<?>[] classes = annotation.value();
Assert.isTrue(classes.length == 1, JSON_VIEW_HINT_ERROR + param);
return Hints.from(JSON_VIEW_HINT, classes[0]);
}
}
return Hints.none();
}
@Override
protected Map<String, Object> getReadHints(ResolvableType actualType, ResolvableType elementType,
ServerHttpRequest request, ServerHttpResponse response) {
String name = request.getHeaders().getContentDisposition().getFilename();
return StringUtils.hasText(name) ? Hints.from(ResourceDecoder.FILENAME_HINT, name) : Hints.none();
}
protected Map<String, Object> getHints(ResolvableType resolvableType) {
MethodParameter param = getParameter(resolvableType);
if (param != null) {
JsonView annotation = getAnnotation(param, JsonView.class);
if (annotation != null) {
Class<?>[] classes = annotation.value();
Assert.isTrue(classes.length == 1, JSON_VIEW_HINT_ERROR + param);
return Hints.from(JSON_VIEW_HINT, classes[0]);
}
}
return Hints.none();
}
@Override
public Map<String, Object> getEncodeHints(@Nullable ResolvableType actualType, ResolvableType elementType,
@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {
return (actualType != null ? getHints(actualType) : Hints.none());
}
@Override
public Map<String, Object> getEncodeHints(@Nullable ResolvableType actualType, ResolvableType elementType,
@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {
return (actualType != null ? getHints(actualType) : Hints.none());
}
/**
* Get decoding hints based on the server request or annotations on the
* target controller method parameter.
* @param actualType the actual source type to encode, possibly a reactive
* wrapper and sourced from {@link org.springframework.core.MethodParameter},
* i.e. providing access to method annotations.
* @param elementType the element type within {@code Flux/Mono} that we're
* trying to encode.
* @param request the current request
* @param response the current response
* @return a Map with hints, possibly empty
*/
default Map<String, Object> getEncodeHints(ResolvableType actualType, ResolvableType elementType,
@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {
return Hints.none();
}
/**
* Get decoding hints based on the server request or annotations on the
* target controller method parameter.
* @param actualType the actual source type to encode, possibly a reactive
* wrapper and sourced from {@link org.springframework.core.MethodParameter},
* i.e. providing access to method annotations.
* @param elementType the element type within {@code Flux/Mono} that we're
* trying to encode.
* @param request the current request
* @param response the current response
* @return a Map with hints, possibly empty
*/
default Map<String, Object> getEncodeHints(ResolvableType actualType, ResolvableType elementType,
@Nullable MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) {
return Hints.none();
}