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


Java Completable.error方法代碼示例

本文整理匯總了Java中io.reactivex.Completable.error方法的典型用法代碼示例。如果您正苦於以下問題:Java Completable.error方法的具體用法?Java Completable.error怎麽用?Java Completable.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.reactivex.Completable的用法示例。


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

示例1: editPost

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable editPost(int accountId, int ownerId, int postId, Boolean friendsOnly,
                            String message, List<AbsModel> attachments, String services,
                            Boolean signed, Long publishDate, Double latitude, Double longitude,
                            Integer placeId, Boolean markAsAds) {

    List<IAttachmentToken> tokens = null;

    try {
        if (nonEmpty(attachments)) {
            tokens = Model2Dto.createTokens(attachments);
        }
    } catch (Exception e) {
        return Completable.error(e);
    }

    return networker.vkDefault(accountId)
            .wall()
            .edit(ownerId, postId, friendsOnly, message, tokens, services,
                    signed, publishDate, latitude, longitude, placeId, markAsAds)
            .flatMapCompletable(aBoolean -> getAndStorePost(accountId, ownerId, postId).toCompletable());
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:23,代碼來源:WallsImpl.java

示例2: contramap

import io.reactivex.Completable; //導入方法依賴的package包/類
/**
 * Transforms the current Sink into another Sink that transforms each incoming payload (encapsulated in the
 * {@link Data} before calling current Sink. In other words, it creates a new Sink receiving data. Each data is
 * processed using the given function and the result is passed to the current Sink.
 * <p>
 * Notice that if the function return {@code null}, the data is ignored.
 *
 * @param function the function transforming the incoming data
 * @param <X>      the type of data received by the resulting sink
 * @return the new sink
 */
default <X> Sink<X> contramap(Function<X, Data<OUT>> function) {
  return data -> {
    try {
      Data<OUT> processed = function.apply(data.payload());
      if (processed != null) {
        return Sink.this.dispatch(processed);
      } else {
        // Data ignored.
        return Completable.complete();
      }
    } catch (Exception e) {
      return Completable.error(e);
    }
  };
}
 
開發者ID:cescoffier,項目名稱:fluid,代碼行數:27,代碼來源:Sink.java

示例3: register

import io.reactivex.Completable; //導入方法依賴的package包/類
private Completable register(VkPushRegistration registration) {
    try {
        JSONArray fr_of_fr = new JSONArray();
        fr_of_fr.put("fr_of_fr");

        JSONObject json = new JSONObject();
        json.put("msg", "on"); // личные сообщения +
        json.put("chat", "on"); // групповые чаты +
        json.put("wall_post", "on"); // новая запись на стене пользователя +
        json.put("comment", "on"); // комментарии +
        json.put("reply", "on"); // ответы +
        json.put("wall_publish", "on"); // размещение предложенной новости +
        json.put("friend", "on");  // запрос на добавления в друзья +
        json.put("friend_accepted", "on"); // подтверждение заявки в друзья +
        json.put("group_invite", "on"); // приглашение в сообщество +
        json.put("birthday", "on"); // уведомления о днях рождениях на текущую дату

        //(хер приходят)
        json.put("like", "on"); // отметки "Мне нравится"
        json.put("group_accepted", fr_of_fr); // подтверждение заявки на вступление в группу - (хер приходят) 09.01.2016
        json.put("mention", fr_of_fr); // упоминания - (хер приходят) 09.01.2016
        json.put("repost", fr_of_fr); // действия "Рассказать друзьям" - (хер приходят) 09.01.2016

        json.put("new_post", "on"); //записи выбранных людей и сообществ;

        final String targetSettingsStr = json.toString();
        final String deviceModel = Utils.getDeviceName();
        final String osVersion = Utils.getAndroidVersion();

        return networker.vkManual(registration.getUserId(), registration.getVkToken())
                .account()
                .registerDevice(registration.getGmcToken(), deviceModel, null, registration.getDeviceId(), osVersion, targetSettingsStr)
                .toCompletable();
    } catch (JSONException e) {
        return Completable.error(e);
    }
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:38,代碼來源:PushRegistrationResolver.java

示例4: createProfile

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable createProfile(Profile profile) {
    if (returnFailure){
        return Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeDatabaseService.java

示例5: deleteProfile

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable deleteProfile(String uid) {
    if (returnFailure){
        return Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeDatabaseService.java

示例6: updateProfile

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable updateProfile(Profile profile) {
    if (returnFailure){
        return Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeDatabaseService.java

示例7: createAccount

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable createAccount(Credentials cred) {
    if (returnFailure){
       return Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeAuthService.java

示例8: attemptLogin

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable attemptLogin(Credentials cred) {
    if (returnFailure){
        return  Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeAuthService.java

示例9: deleteUser

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable deleteUser() {
    if (returnFailure){
        return  Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeAuthService.java

示例10: logUserOut

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable logUserOut() {
    if (returnFailure){
        return Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeAuthService.java

示例11: reauthenticateUser

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable reauthenticateUser(String password) {
    if (returnFailure){
        return Completable.error(new Exception());
    }
    return Completable.complete();
}
 
開發者ID:BracketCove,項目名稱:Profiler,代碼行數:8,代碼來源:FakeAuthService.java

示例12: apply

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable apply(@io.reactivex.annotations.NonNull Boolean success) throws Exception {
    return success ? Completable.complete() : Completable.error(new LocationSettingsNotSatisfiedException());
}
 
開發者ID:TechIsFun,項目名稱:RxJava2-weather-example,代碼行數:5,代碼來源:LocationSettings.java

示例13: apply

import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable apply(Object ignore) throws Exception {
    return Completable.error(new CancellationException());
}
 
開發者ID:xufreshman,項目名稱:RxLifeCycle,代碼行數:5,代碼來源:Functions.java


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