@Override
public Object aroundReadFrom(ReaderInterceptorContext context) throws IOException, WebApplicationException {
if (!isVersioningSupported(context)) {
return context.proceed();
}
String sourceVersion = Version.get(context);
Type targetType = context.getGenericType();
Type sourceType = getVersionType(targetType, sourceVersion);
context.setType(toClass(sourceType));
context.setGenericType(sourceType);
Object sourceObject = context.proceed();
Object target;
if (sourceObject instanceof Collection) {
target = convertCollectionToHigherVersion(targetType, (Collection<?>)sourceObject, sourceVersion);
} else {
target = converter.convertToHigherVersion(toClass(targetType), sourceObject, sourceVersion);
}
context.setType(toClass(targetType));
context.setGenericType(targetType);
return target;
}
MessageBodyConverter.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:jaxrs-versioning
作者:
评论列表
文章目录