本文整理匯總了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());
}
示例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);
}
};
}
示例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);
}
}
示例4: createProfile
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable createProfile(Profile profile) {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例5: deleteProfile
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable deleteProfile(String uid) {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例6: updateProfile
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable updateProfile(Profile profile) {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例7: createAccount
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable createAccount(Credentials cred) {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例8: attemptLogin
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable attemptLogin(Credentials cred) {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例9: deleteUser
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable deleteUser() {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例10: logUserOut
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable logUserOut() {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例11: reauthenticateUser
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable reauthenticateUser(String password) {
if (returnFailure){
return Completable.error(new Exception());
}
return Completable.complete();
}
示例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());
}
示例13: apply
import io.reactivex.Completable; //導入方法依賴的package包/類
@Override
public Completable apply(Object ignore) throws Exception {
return Completable.error(new CancellationException());
}