当前位置: 首页>>代码示例>>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;未经允许,请勿转载。