RestNetworkService.java 文件源码

java
阅读 42 收藏 0 点赞 0 评论 0

项目:Capstone2016 作者:
@Override
public ReadOnlyObjectProperty<RequestStatus> loadCatchTypes(Consumer<CatchType> loadCallback) {
    RestClient catchTypeClient = RestClient.create().method("GET").host("https://api.nestnz.org")
            .path("/catch-type").connectTimeout(TIMEOUT);
    return processReadRequest(ApiCatchType.class, catchTypeClient, apiCatchType -> {
        URL imageUrl = null;
        if (apiCatchType.getImageUrl() != null) {
            try {
                imageUrl = new URL(apiCatchType.getImageUrl());
            } catch (MalformedURLException ex) {
                LOG.log(Level.WARNING, "Error decoding image url: "+apiCatchType.getImageUrl(), ex);
            }
        }
        CatchType catchType = new CatchType(apiCatchType.getId(), apiCatchType.getName(), imageUrl);
        loadCallback.accept(catchType);
    });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号