本文整理了Java中com.weibo.yar.YarResponse.getError()
方法的一些代码示例,展示了YarResponse.getError()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarResponse.getError()
方法的具体详情如下:
包路径:com.weibo.yar.YarResponse
类名称:YarResponse
方法名:getError
暂无
代码示例来源:origin: weibocom/motan
public static Response convert(YarResponse yarResponse) {
DefaultResponse response = new DefaultResponse();
response.setRequestId(yarResponse.getId());
response.setValue(yarResponse.getRet());
if (StringUtils.isNotBlank(yarResponse.getError())) {
response.setException(new MotanBizException(yarResponse.getError()));
}
return response;
}
代码示例来源:origin: com.weibo/yar-java
protected <E> E buildResponse(byte[] responseBytes, Class<E> responseClass) throws IOException {
YarResponse yarResponse = YarProtocol.buildResponse(responseBytes);
if (yarResponse == null || yarResponse.getError() != null) {
throw new YarException(yarResponse == null ? "yar response is null" : yarResponse.getError());
}
E value = yarResponse.getValue(responseClass);
return value;
}
代码示例来源:origin: com.weibo/yar-java
public static byte[] toProtocolBytes(YarResponse response) throws IOException {
if (response == null) {
throw new YarException("YarResponse is null");
}
Map<String, Object> responseMap = new HashMap<String, Object>();
responseMap.put("i", response.getId());
responseMap.put("s", response.getStatus());
if (response.getRet() != null) {
responseMap.put("r", response.getRet());
}
if (response.getOutput() != null) {
responseMap.put("o", response.getOutput());
}
if (response.getError() != null) {
responseMap.put("e", response.getError());
}
String packagerName = response.getPackagerName();
return toProtocolBytes(response.getId(), packagerName, responseMap);
}
内容来源于网络,如有侵权,请联系作者删除!