当前位置: 首页>>代码示例>>Java>>正文


Java Deferred.resolve方法代码示例

本文整理汇总了Java中org.jdeferred.Deferred.resolve方法的典型用法代码示例。如果您正苦于以下问题:Java Deferred.resolve方法的具体用法?Java Deferred.resolve怎么用?Java Deferred.resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdeferred.Deferred的用法示例。


在下文中一共展示了Deferred.resolve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: changePassword

import org.jdeferred.Deferred; //导入方法依赖的package包/类
@Override
public Promise<Void, BError, Void> changePassword(String email, String oldPassword, String newPassword){
    
    final Deferred<Void, BError, Void> deferred = new DeferredObject<>();

    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

    OnCompleteListener<Void> resultHandler = new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful()) {
                deferred.resolve(null);
            } else {
                deferred.reject(getFirebaseError(DatabaseError.fromException(task.getException())));

            }
        }
    };

    user.updatePassword(newPassword).addOnCompleteListener(resultHandler);

    return deferred.promise();
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:24,代码来源:BChatcatNetworkAdapter.java

示例2: sendPasswordResetMail

import org.jdeferred.Deferred; //导入方法依赖的package包/类
@Override
public Promise<Void, BError, Void> sendPasswordResetMail(String email){

    final Deferred<Void, BError, Void> deferred = new DeferredObject<>();

    OnCompleteListener<Void> resultHandler = new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful()) {
                if(DEBUG) Timber.v("Email sent");
                deferred.resolve(null);
            } else {
                deferred.reject(getFirebaseError(DatabaseError.fromException(task.getException())));

            }
        }
    };

    FirebaseAuth.getInstance().sendPasswordResetEmail(email).addOnCompleteListener(resultHandler);
    
    return deferred.promise();
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:23,代码来源:BChatcatNetworkAdapter.java

示例3: handleMessage

import org.jdeferred.Deferred; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msg) {
    super.handleMessage(msg);

    switch (msg.what){
        case 1:
            MessageObj obj = (MessageObj) msg.obj;
            if (obj.listener instanceof Deferred)
            {
                Deferred<Object, BError, Void> deferred= ((DeferredObject) obj.listener);


                if (msg.arg1 == ERROR)
                    deferred.reject((BError) obj.data);
                else deferred.resolve(obj.data);
            }
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:19,代码来源:TwitterManager.java

示例4: resolveAll

import org.jdeferred.Deferred; //导入方法依赖的package包/类
public static <R> void resolveAll(List<R> result, List<Deferred> deferreds) {
  Preconditions.checkArgument(result.size() == deferreds.size());
  for (int i = 0; i < result.size(); i++) {
    Deferred deferred = deferreds.get(i);
    R ret = result.get(i);
    deferred.resolve(ret);
  }
}
 
开发者ID:tramchamploo,项目名称:buffer-slayer,代码行数:9,代码来源:Deferreds.java


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