• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CheckReturnValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.reactivex.annotations.CheckReturnValue的典型用法代码示例。如果您正苦于以下问题:Java CheckReturnValue类的具体用法?Java CheckReturnValue怎么用?Java CheckReturnValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CheckReturnValue类属于io.reactivex.annotations包,在下文中一共展示了CheckReturnValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onComplete

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * @param emit
 * @param <R>
 * @return
 */
@NonNull
@CheckReturnValue
public static <R> OnCompleteListener<R> listener(@NonNull final MaybeEmitter<R> emit) {
    return new OnCompleteListener<R>() {
        @Override
        public void onComplete(@NonNull final Task<R> task) {
            if (!emit.isDisposed()) {
                if (task.isSuccessful()) {
                    R result = task.getResult();
                    if (result != null) {
                        emit.onSuccess(result);
                    }
                    emit.onComplete();
                } else {
                    Exception e = task.getException();
                    emit.onError(e != null ? e : new RuntimeException());
                }
            }
        }
    };
}
 
开发者ID:yongjhih,项目名称:rxtasks,代码行数:27,代码来源:RxTask.java


示例2: apply

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@Override
@NonNull
@CheckReturnValue
public ObservableSource<DataValue<T>> apply(@NonNull Observable<DataSnapshot> upstream) {
    return upstream.map(new Function<DataSnapshot, DataValue<T>>() {
        @Override
        public DataValue<T> apply(DataSnapshot dataSnapshot) throws Exception {
            DataValue<T> result;
            if (dataSnapshot.exists()) {
                result = DataValue.of(dataSnapshot.getValue(typeIndicator));
            } else {
                result = DataValue.empty();
            }
            return result;
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxfirebase,代码行数:18,代码来源:TransformerOfGenericTypeIndicator.java


示例3: apply

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@Override
@NonNull
@CheckReturnValue
public ObservableSource<DataValue<T>> apply(@NonNull Observable<DataSnapshot> upstream) {
    return upstream.map(new Function<DataSnapshot, DataValue<T>>() {
        @Override
        public DataValue<T> apply(DataSnapshot dataSnapshot) throws Exception {
            DataValue<T> result;
            if (dataSnapshot.exists()) {
                result = DataValue.of(dataSnapshot.getValue(clazz));
            } else {
                result = DataValue.empty();
            }
            return result;
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxfirebase,代码行数:18,代码来源:TransformerOfClazz.java


示例4: listener

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * @param emit
 * @return
 */
@NonNull
@CheckReturnValue
public static ValueEventListener listener(@NonNull final SingleEmitter<DataSnapshot> emit) {
    return new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
            if (!emit.isDisposed()) {
                emit.onSuccess(dataSnapshot);
            }
        }

        @Override
        public void onCancelled(DatabaseError e) {
            if (!emit.isDisposed()) {
                emit.onError(e.toException());
            }
        }
    };
}
 
开发者ID:yongjhih,项目名称:rxfirebase,代码行数:24,代码来源:RxValue.java


示例5: call

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * @param user
 * @param forceRefresh
 * @return
 */
@CheckReturnValue
@NonNull
public static Single<String> getToken(@NonNull final FirebaseUser user,
                                      final boolean forceRefresh) {
    return RxTask.single(new Callable<Task<GetTokenResult>>() {
        @Override
        public Task<GetTokenResult> call() throws Exception {
            return user.getToken(forceRefresh);
        }
    })
    .map(new Function<GetTokenResult, String>() {
        @Override
        public String apply(@NonNull GetTokenResult getTokenResult) throws Exception {
            return getTokenResult.getToken();
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxfirebase,代码行数:23,代码来源:RxFirebaseUser.java


示例6: call

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * TODO: Should use Maybe instead of Single
 * TODO: flatten List
 *
 * @param instance
 * @param email
 * @return &lt;emptyList&gt; if providers is null
 */
@CheckReturnValue
@NonNull
public static Single<List<String>> fetchProvidersForEmail(
        @NonNull final FirebaseAuth instance, @NonNull final String email) {
    return RxTask.single(new Callable<Task<ProviderQueryResult>>() {
        @Override
        public Task<ProviderQueryResult> call() throws Exception {
            return instance.fetchProvidersForEmail(email);
        }
    }).map(new Function<ProviderQueryResult, List<String>>() {
        @Override
        public List<String> apply(@NonNull ProviderQueryResult providerQueryResult)
                throws Exception {
            List<String> providers = providerQueryResult.getProviders();
            if (null == providers) {
                providers = Collections.emptyList();
            }
            return providers;
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxfirebase,代码行数:30,代码来源:RxFirebaseAuth.java


示例7: observable

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@CheckReturnValue
@NonNull
public static <R> Observable<R> observable(@NonNull final Task<R> task) {
    return Observable.create(emitter -> {
        task.continueWith(t -> {
            if (emitter.isDisposed()) return null;

            if (t.isCancelled()) {
                // NOTICE: doOnUnsubscribe(() -> Observable.just(query) in outside
                emitter.onComplete();
            } else if (t.isFaulted()) {
                Throwable error = t.getError();
                emitter.onError(error);
            } else {
                R r = t.getResult();
                if (r != null) emitter.onNext(r);
                emitter.onComplete();
            }
            return null;
        });
    });
    // TODO .doOnUnsubscribe(() -> task.setCancelled());
}
 
开发者ID:yongjhih,项目名称:RxBolts,代码行数:24,代码来源:RxTask.java


示例8: single

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * Please don't put the Task&lt;Void&gt; as parameter
 * @param task
 * @param <R>
 * @return
 */
@CheckReturnValue
@NonNull
public static <R> Single<R> single(@NonNull final Task<R> task) {
    return Single.create(emitter -> {
        task.continueWith(t -> {
            if (emitter.isDisposed()) return null;

            if (t.isCancelled()) {
                emitter.onError(new RuntimeException("Cancelled task"));
            } else if (t.isFaulted()) {
                Throwable error = t.getError();
                emitter.onError(error);
            } else {
                R r = t.getResult();
                emitter.onSuccess(r);
            }
            return null;
        });
    });
    // TODO .doOnUnsubscribe(() -> task.setCancelled());
}
 
开发者ID:yongjhih,项目名称:RxBolts,代码行数:28,代码来源:RxTask.java


示例9: all

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 *  Limit 10000 by skip
 */
@NonNull
@CheckReturnValue
public static <R extends ParseObject> Observable<R> all(@NonNull final ParseQuery<R> query, int count) {
    final int limit = 1000; // limit limitation
    query.setSkip(0);
    query.setLimit(limit);
    Observable<R> find = find(query);
    for (int i = limit; i < count; i+= limit) {
        if (i >= 10000) break; // skip limitation
        query.setSkip(i);
        query.setLimit(limit);
        find.concatWith(find(query));
    }
    return find.distinct(o -> o.getObjectId());
}
 
开发者ID:yongjhih,项目名称:RxParse,代码行数:19,代码来源:ParseObservable.java


示例10: ensureEach

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * Map emitted items from the source observable into {@link Permission} objects for each
 * permission in parameters.
 * <p>
 * If one or several permissions have never been requested, invoke the related framework method
 * to ask the user if he allows the permissions.
 */
@NonNull @CheckReturnValue private <T> ObservableTransformer<T, Permission> ensureEach(@NonNull final String... permissions) {
  checkPermissions(permissions);

  return new ObservableTransformer<T, Permission>() {
    @Override @NonNull @CheckReturnValue public ObservableSource<Permission> apply(final Observable<T> o) {
      return request(o, permissions);
    }
  };
}
 
开发者ID:vanniktech,项目名称:RxPermission,代码行数:17,代码来源:RealRxPermission.java


示例11: request

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@NonNull @CheckReturnValue @SuppressWarnings("checkstyle:overloadmethodsdeclarationorder") Observable<Permission> request(final Observable<?> trigger, @NonNull final String... permissions) {
  return Observable.merge(trigger, pending(permissions))
      .flatMap(new Function<Object, Observable<Permission>>() {
        @Override @NonNull @CheckReturnValue public Observable<Permission> apply(final Object o) throws Exception { // NOPMD
          return requestOnM(permissions);
        }
      });
}
 
开发者ID:vanniktech,项目名称:RxPermission,代码行数:9,代码来源:RealRxPermission.java


示例12: pending

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@NonNull @CheckReturnValue private Observable<?> pending(@NonNull final String... permissions) {
  for (final String p : permissions) {
    if (!currentPermissionRequests.containsKey(p)) {
      return Observable.empty();
    }
  }

  return Observable.just(TRIGGER);
}
 
开发者ID:vanniktech,项目名称:RxPermission,代码行数:10,代码来源:RealRxPermission.java


示例13: requestOnM

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@NonNull @CheckReturnValue @TargetApi(M) Observable<Permission> requestOnM(@NonNull final String... permissions) {
  final List<Observable<Permission>> list = new ArrayList<>(permissions.length);
  final List<String> unrequestedPermissions = new ArrayList<>();

  // In case of multiple permissions, we create an observable for each of them.
  // At the end, the observables are combined to have a unique response.

  for (final String permission : permissions) {
    if (isGranted(permission)) {
      list.add(Observable.just(Permission.granted(permission)));
    } else if (isRevokedByPolicy(permission)) {
      list.add(Observable.just(Permission.revokedByPolicy(permission)));
    } else {
      PublishSubject<Permission> subject = currentPermissionRequests.get(permission);

      // Create a new subject if not exists
      if (subject == null) {
        unrequestedPermissions.add(permission);
        subject = PublishSubject.create();
        currentPermissionRequests.put(permission, subject);
      }

      list.add(subject);
    }
  }

  if (!unrequestedPermissions.isEmpty()) {
    final String[] permissionsToRequest = unrequestedPermissions.toArray(new String[0]);
    startShadowActivity(permissionsToRequest);
  }

  return Observable.concat(Observable.fromIterable(list));
}
 
开发者ID:vanniktech,项目名称:RxPermission,代码行数:34,代码来源:RealRxPermission.java


示例14: single

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * @param callable
 * @param <R>
 * @return
 */
@CheckReturnValue
@NonNull
public static <R> Single<R> single(@NonNull final Callable<Task<R>> callable) {
    return Single.fromCallable(callable).flatMap(new Function<Task<R>,
            SingleSource<? extends R>>() {
        @Override
        public SingleSource<? extends R> apply(Task<R> task) throws Exception {
            return single(task);
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxtasks,代码行数:17,代码来源:RxTask.java


示例15: subscribe

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * @param task
 * @param <R>
 * @return
 */
@CheckReturnValue
@NonNull
public static <R> Single<R> single(@NonNull final Task<R> task) {
    return Single.create(new SingleOnSubscribe<R>() {
        @Override
        public void subscribe(@NonNull final SingleEmitter<R> emit) throws Exception {
            task.addOnCompleteListener(listener(emit));
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxtasks,代码行数:16,代码来源:RxTask.java


示例16: apply

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * @param callable
 * @param <R>
 * @return
 */
@CheckReturnValue
@NonNull
public static <R> Completable completes(@NonNull final Callable<Task<R>> callable) {
    return Single.fromCallable(callable).flatMapCompletable(
            new Function<Task<R>, Completable>() {
        @Override
        public Completable apply(Task<R> task) throws Exception {
            return completes(task);
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxtasks,代码行数:17,代码来源:RxTask.java


示例17: maybe

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * @param callable
 * @param <R>
 * @return
 */
@CheckReturnValue
@NonNull
public static <R> Maybe<R> maybe(@NonNull final Callable<Task<R>> callable) {
    return Single.fromCallable(callable).flatMapMaybe(
            new Function<Task<R>, MaybeSource<? extends R>>() {
        @Override
        public MaybeSource<? extends R> apply(Task<R> task) throws Exception {
            return maybe(task);
        }
    });
}
 
开发者ID:yongjhih,项目名称:rxtasks,代码行数:17,代码来源:RxTask.java


示例18: subscribe

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
/**
 * Auto close client
 * mqttConnectOptions.userName = it }$
 * mqttConnectOptions.password = it.toCharArray() }
 * @param client
 * @param topic
 * @return
 */
@NonNull
@CheckReturnValue
public static Observable<MqttMessage> remessage(@NonNull final MqttAndroidClient client,
                                                @NonNull final String topic) {
    final Observable<MqttMessage> msgObs =
            Observable.create(new ObservableOnSubscribe<MqttMessage>() {
        public void subscribe(
                @NonNull final ObservableEmitter<MqttMessage> emitter) throws Exception {
            client.subscribe(topic, 0, new IMqttMessageListener() {
                @Override
                public void messageArrived(
                        String topic2, @NonNull final MqttMessage message) throws Exception {
                    if (!emitter.isDisposed()) {
                        emitter.onNext(message);
                    }
                }
            });
        }
    });

    if (client.isConnected()) {
        return msgObs;
    } else {
        return reconnect(client).flatMapObservable(
                new Function<IMqttToken, ObservableSource<MqttMessage>>() {
            @Override
            public ObservableSource<MqttMessage> apply(IMqttToken token) throws Exception {
                return msgObs;
            }
        });
    }
}
 
开发者ID:yongjhih,项目名称:rx-mqtt,代码行数:41,代码来源:RxMqtt.java


示例19: connect

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@NonNull
@CheckReturnValue
public static Maybe<IMqttToken> connect(
        @NonNull final MqttAndroidClient client,
        @NonNull final DisconnectedBufferOptions disconnectedBufferOptions) {
    return connect(client, new MqttConnectOptions(), disconnectedBufferOptions);
}
 
开发者ID:yongjhih,项目名称:rx-mqtt,代码行数:8,代码来源:RxMqtt.java


示例20: defaultDisconnectedBufferOptions

import io.reactivex.annotations.CheckReturnValue; //导入依赖的package包/类
@NonNull
@CheckReturnValue
public static DisconnectedBufferOptions defaultDisconnectedBufferOptions() {
    final DisconnectedBufferOptions bufferOptions = new DisconnectedBufferOptions();
    bufferOptions.setBufferEnabled(true);
    bufferOptions.setBufferSize(100);
    bufferOptions.setPersistBuffer(false);
    bufferOptions.setDeleteOldestMessages(false);
    return bufferOptions;
}
 
开发者ID:yongjhih,项目名称:rx-mqtt,代码行数:11,代码来源:RxMqtt.java



注:本文中的io.reactivex.annotations.CheckReturnValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RequestEnhancer类代码示例发布时间:2022-05-23
下一篇:
Java LatvianStemFilter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap