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


Java NonNull類代碼示例

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


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

示例1: startRefresh

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
@Override
protected void startRefresh(HandleBase<StickyItem> refreshData) {
    Flowable.just(refreshData)
            .onBackpressureDrop()
            .observeOn(Schedulers.computation())
            .map(new Function<HandleBase<StickyItem>, DiffUtil.DiffResult>() {
                @Override
                public DiffUtil.DiffResult apply(@NonNull HandleBase<StickyItem> handleBase) throws Exception {
                    return handleRefresh(handleBase.getNewData(), handleBase.getNewHeader(), handleBase.getNewFooter(), handleBase.getType(), handleBase.getRefreshType());
                }
            })
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Consumer<DiffUtil.DiffResult>() {
                @Override
                public void accept(@NonNull DiffUtil.DiffResult diffResult) throws Exception {
                    handleResult(diffResult);
                }
            });
}
 
開發者ID:crazysunj,項目名稱:MultiTypeRecyclerViewAdapter,代碼行數:20,代碼來源:ErrorAndEmptyAdapterHelper.java

示例2: test0

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
@Override
public void test0() {
    Log.i(TAG, "test0() Map simple demo, integer 1,2,3 transform to string 2,4,6");
    Observable.just(1, 2, 3).map(new Function<Integer, String>() {
        @Override
        public String apply(@NonNull Integer integer) throws Exception {
            return Integer.toString(integer * 2);
        }
    }).subscribe(new Consumer<String>() {
        @Override
        public void accept(String s) throws Exception {
            Log.d(TAG, "Consumer<String> accept() s: " + s);
        }
    }, new Consumer<Throwable>() {
        @Override
        public void accept(Throwable throwable) throws Exception {
            Log.d(TAG, "Consumer<Throwable> accept() throwable: " + throwable);
        }
    }, new Action() {
        @Override
        public void run() throws Exception {
            Log.d(TAG, "Action run() for onComplete()");
        }
    });
}
 
開發者ID:afunx,項目名稱:RxJava4AndroidDemos,代碼行數:26,代碼來源:Map.java

示例3: updateEvenStatus

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
private void updateEvenStatus(int status, BIncidentRemark note) {
  showProgress();
  wrap(ApiHelper.getInstance().updateEventStatus(incidentDto.getId(), status, note)).subscribe(
      new BaseObserver<IncidentDto>(EditInfoActivity.this) {
        @Override public void onNext(@NonNull IncidentDto responseBody) {
          hideProgress();
          super.onNext(responseBody);
          ToastUtils.showShortSafe("success");
          RxBus.getInstance().send(new UpdateEvent(true));
          finish();
        }

        @Override public void onError(@NonNull Throwable e) {
          hideProgress();
          super.onError(e);
          ToastUtils.showShortSafe("failure");
          pbClaim.setVisibility(View.GONE);
          sl.setVisibility(View.VISIBLE);
        }
      });
}
 
開發者ID:Lingzh0ng,項目名稱:ITSM,代碼行數:22,代碼來源:EditInfoActivity.java

示例4: getResultActivity

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
private void getResultActivity()
{
    final Intent intent = new Intent(getActivity(), Result.class);

    RxActivityResultCompact.startActivityForResult(this, intent, REQUEST_CODE)
            .subscribe(new Consumer<ActivityResult>() {
                @Override
                public void accept(@NonNull ActivityResult result) throws Exception {
                    if (result.isOk()) {
                        final String txt = result.getData().getStringExtra(Result.GET_TEXT);
                        textresult.setText(txt);
                    }
                }
            });

}
 
開發者ID:datalink747,項目名稱:Rx_java2_soussidev,代碼行數:17,代碼來源:RxActivityResult_fragment.java

示例5: checkUpdateIfUsingWifi

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
private Observable<VersionInfo> checkUpdateIfUsingWifi(Context context) {
    if (!NetworkUtils.isWifiAvailable(context)) {
        return Observable.empty();
    }
    Observable<VersionInfo> observable = checkForUpdates();
    observable.subscribe(new SimpleObserver<VersionInfo>() {
        @Override
        public void onNext(@NonNull VersionInfo versionInfo) {
            if (versionInfo.isValid()) {
                setVersionInfo(versionInfo);
            }
        }

        @Override
        public void onError(@NonNull Throwable e) {
            e.printStackTrace();
        }
    });
    return observable;
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:21,代碼來源:VersionService.java

示例6: testRx

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
private void testRx() {

        Observable.just("tony")
                .subscribe(new Consumer<String>() {

                    @HookMethod(beforeMethod = "testRxBefore")
                    @Override
                    public void accept(@NonNull String s) throws Exception {
                        System.out.println("s="+s);
                    }

                    private void testRxBefore() {
                        L.i("testRxBefore() is called before accept()");
                    }
                });
    }
 
開發者ID:fengzhizi715,項目名稱:SAF-AOP,代碼行數:17,代碼來源:DemoForHookMethodActivity.java

示例7: getSearchUserResultFromServer

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
public void getSearchUserResultFromServer(String value){
    OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().getSearchUserList(value),
            new OvObserver<HttpResult<List<SearchUserBean>>>() {
                @Override
                protected void setNeedContext() {
                    setContext(mContext);
                }

                @Override
                protected void setProgress(boolean isShow) {
                    super.setProgress(false);
                }

                @Override
                protected void _onNext(@NonNull HttpResult<List<SearchUserBean>> listHttpResult) {
                    mPresenter.showSearchUserList(listHttpResult.getData());
                }

                @Override
                protected void _onError(@NonNull Throwable e) {
                    mPresenter.showNoSearchResult("該用戶不存在");
                }
            });
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:25,代碼來源:SearchUserModel.java

示例8: takePartInPatyToServer

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
public void takePartInPatyToServer(String partyId,String uid){
    OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().takePartInTheParty(partyId, uid),
            new OvObserver<HttpResult<String>>() {
                @Override
                protected void setNeedContext() {
                    setContext(mContext);
                }

                @Override
                protected void setProgress(boolean isShow) {
                    super.setProgress(false);
                }

                @Override
                protected void _onNext(@NonNull HttpResult<String> stringHttpResult) {
                    mPresenter.showTakePartPartyResult(stringHttpResult.getMsg());
                }

                @Override
                protected void _onError(@NonNull Throwable e) {

                }
            });
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:25,代碼來源:LifeDetailModel.java

示例9: test0

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
@Override
public void test0() {
    Log.i(TAG, "test0() FlatMap simple demo, integer 1,2,3 transform to string 2,3,4,6,6,9");
    Observable.just(1, 2, 3).flatMap(new Function<Integer, ObservableSource<String>>() {
        @Override
        public ObservableSource<String> apply(@NonNull Integer integer) throws Exception {
            return Observable.just(integer * 2 + "", integer * 3 + "");
        }
    }).subscribe(new Consumer<String>() {
        @Override
        public void accept(String s) throws Exception {
            Log.d(TAG, "Consumer<String> accept() s: " + s);
        }
    }, new Consumer<Throwable>() {
        @Override
        public void accept(Throwable throwable) throws Exception {
            Log.d(TAG, "Consumer<Throwable> accept() throwable: " + throwable);
        }
    }, new Action() {
        @Override
        public void run() throws Exception {
            Log.d(TAG, "Action run() for onComplete()");
        }
    });
}
 
開發者ID:afunx,項目名稱:RxJava4AndroidDemos,代碼行數:26,代碼來源:FlatMap.java

示例10: debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
@Test
public void debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug() {

    InternalConfiguration config = InternalConfiguration
            .getInstance("debugWhileChainConfigIsNotDebuggingThenDoNotInvokeDebug");
    config.setDebugging(false);

    final boolean[] result = {false};

    new Chain<>(new TestClass(), config)
            .debug(new Consumer<TestClass>() {
                @Override
                public void accept(@NonNull TestClass testClass) throws Exception {
                    result[0] = true;
                }
            });

    assertFalse(result[0]);
}
 
開發者ID:Ahmed-Adel-Ismail,項目名稱:J-Chain,代碼行數:20,代碼來源:ChainTest.java

示例11: reduceWithMultipleItemsThenReturnFunctionResult

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
@Test
public void reduceWithMultipleItemsThenReturnFunctionResult() {
    boolean result = new Collector<Boolean>(configuration)
            .and(true)
            .and(false)
            .and(true)
            .reduce(new BiFunction<Boolean, Boolean, Boolean>() {

                @Override
                public Boolean apply(@NonNull Boolean itemOne, @NonNull Boolean itemTwo) {
                    return itemOne.equals(itemTwo);
                }
            })
            .call();

    assertFalse(result);
}
 
開發者ID:Ahmed-Adel-Ismail,項目名稱:J-Chain,代碼行數:18,代碼來源:CollectorTest.java

示例12: addConcernToServer

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
public void addConcernToServer(String userId,String userById){
    OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().addConcern(userId, userById),
            new OvObserver<HttpResult<String>>() {
                @Override
                protected void setNeedContext() {
                    setContext(mContext);
                }

                @Override
                protected void setProgress(boolean isShow) {
                    super.setProgress(false);
                }

                @Override
                protected void _onNext(@NonNull HttpResult<String> stringHttpResult) {
                    if (stringHttpResult.getStatus()==1){
                        mPresenter.showAddConcern(stringHttpResult.getData());
                    }
                }

                @Override
                protected void _onError(@NonNull Throwable e) {

                }
            });
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:27,代碼來源:SearchUserModel.java

示例13: executeMiddleware

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
private <TAction extends Action> void executeMiddleware(@NonNull final TAction action) {
    if (mMiddlewareList.size() > 0) {
        synchronized (mMiddlewareSyncRoot) {
            Observable.fromIterable(mMiddlewareList)
                    .flatMap(new Function<Middleware, ObservableSource<? extends Action>>() {
                        @Override
                        public ObservableSource<? extends Action> apply(@NonNull Middleware middleware) throws Exception {
                            return middleware.process(action);
                        }
                    })
                    .subscribe(new Consumer<Action>() {
                                   @Override
                                   public void accept(@NonNull Action resultAction) throws Exception {
                                       dispatch(resultAction);
                                   }
                               },
                            new Consumer<Throwable>() {
                                @Override
                                public void accept(@NonNull Throwable throwable) throws Exception {
                                    onMiddlewareError(throwable);
                                }
                            });
        }
    }
}
 
開發者ID:ReactiveMVP,項目名稱:reduxj,代碼行數:26,代碼來源:AbstractStore.java

示例14: loadData

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
private void loadData() {

        if (!NetworkUtils.avaliable()) {
            showNetworkError();
            return;
        }

        Flowable.fromCallable(new Callable<String>() {
            @Override
            public String call() throws Exception {
                Thread.sleep(3000); //  imitate expensive computation
                return "Done";
            }
        })
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Consumer<String>() {
                    @Override
                    public void accept(@NonNull String s) throws Exception {
                        Log.i("LeftFragment", "data received");
                        showEmptyData();
                    }
                });
    }
 
開發者ID:rawray,項目名稱:RRFramework-Android,代碼行數:25,代碼來源:LeftFragment.java

示例15: loadMorePostLists

import io.reactivex.annotations.NonNull; //導入依賴的package包/類
/**
 * 獲取更多數據
 */
public void loadMorePostLists(){
    ++mMoreNum;
    OvRetrofit.getInstance().async(OvRetrofit.getInstance().getService().getNewPostList(uid,String.valueOf(mMoreNum), "10"), new OvObserver<HttpResult<List<PostBean>>>() {
        @Override
        protected void setNeedContext() {
            setContext(mPresenter.getContext());
        }

        @Override
        protected void _onNext(@NonNull HttpResult<List<PostBean>> httpResult) {
            if (httpResult.getData()!=null && httpResult.getData().size()>0){
                mPresenter.loadMorePostsSuccess(httpResult.getData());
            }else {
                mPresenter.loadMorePostNothing();
            }
        }

        @Override
        protected void _onError(@NonNull Throwable e) {
            mPresenter.loadMorePostFailue();
        }
    });
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:27,代碼來源:NewPostModel.java


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