當前位置: 首頁>>代碼示例>>Java>>正文


Java BoxCacheableRequest類代碼示例

本文整理匯總了Java中com.box.androidsdk.content.requests.BoxCacheableRequest的典型用法代碼示例。如果您正苦於以下問題:Java BoxCacheableRequest類的具體用法?Java BoxCacheableRequest怎麽用?Java BoxCacheableRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BoxCacheableRequest類屬於com.box.androidsdk.content.requests包,在下文中一共展示了BoxCacheableRequest類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import com.box.androidsdk.content.requests.BoxCacheableRequest; //導入依賴的package包/類
@Override
public void execute(BoxRequest request) {
    if (request == null) {
        return;
    }
    if (BoxConfig.getCache() != null && request instanceof BoxCacheableRequest){
        try {
            BoxFutureTask cacheTask = ((BoxCacheableRequest) request).toTaskForCachedResult();
            if (mListener != null){
                cacheTask.addOnCompletedListener(mListener);
            }
            getApiExecutor().execute(cacheTask);
        } catch (BoxException e){
            BoxLogUtils.e("cache task error ", e);
        }

    }
    BoxFutureTask task = request.toTask();
    if (mListener != null) {
        task.addOnCompletedListener(mListener);
    }

    // Thumbnail request should be executed in their own executor pool
    ThreadPoolExecutor executor = request instanceof BoxRequestsFile.DownloadThumbnail ?
            getThumbnailExecutor() :
            getApiExecutor();
    executor.submit(task);
}
 
開發者ID:box,項目名稱:box-android-browse-sdk,代碼行數:29,代碼來源:BoxBrowseController.java

示例2: get

import com.box.androidsdk.content.requests.BoxCacheableRequest; //導入依賴的package包/類
@Override
public <T extends BoxObject, R extends BoxRequest & BoxCacheableRequest> T get(R request) throws BoxException {

    if (request instanceof BoxRequestsFolder.GetFolderWithAllItems){
        // Assume fields have not changed.
        return (T)mFullFolderCache.get(((BoxRequestsFolder.GetFolderWithAllItems) request).getId());
    }
    return null;
}
 
開發者ID:box,項目名稱:box-android-browse-sdk,代碼行數:10,代碼來源:BoxSimpleLocalCache.java

示例3: get

import com.box.androidsdk.content.requests.BoxCacheableRequest; //導入依賴的package包/類
/**
 * Returns the last cached BoxObject for this BoxRequest.
 * @param request - The BoxRequest object that can be used for fetching remote data.
 * @param <T> A child of BoxObject
 * @param <R> A child of BoxRequest that implements BoxCacheableRequest
 * @return a BoxObject associated with the request type.
 * @throws BoxException thrown if the request fails.
 */
<T extends BoxObject, R extends BoxRequest & BoxCacheableRequest> T get(R request) throws BoxException;
 
開發者ID:box,項目名稱:box-android-sdk,代碼行數:10,代碼來源:BoxCache.java


注:本文中的com.box.androidsdk.content.requests.BoxCacheableRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。