Skip to content

Commit 594a00f

Browse files
committed
添加注释,修改Promise中个别方法的修饰符
1 parent 488c9c4 commit 594a00f

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/main/java/cn/hackingwu/promise/Function.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package cn.hackingwu.promise;
22

33
/**
4+
* 用Function接口,在外部调用使用匿名类的写法,实现类函数式编程.
5+
* new OnFulfill() {
6+
* public Object execute(Object args) {
7+
* System.out.println("last result : " + args);
8+
* return null;
9+
* }
10+
* }
411
* @author hackingwu.
512
* @since 2016/3/8.
613
*/

src/main/java/cn/hackingwu/promise/Promise.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,27 @@ public Promise Catch(OnReject onReject) {
100100
return then(null, onReject);
101101
}
102102

103-
public Resolver getResolve() {
103+
protected Resolver getResolve() {
104104
return resolve;
105105
}
106106

107-
public PromiseList getPromiseList() {
107+
protected PromiseList getPromiseList() {
108108
return promiseList;
109109
}
110110

111-
public OnFulfill getOnFulfill() {
111+
protected OnFulfill getOnFulfill() {
112112
return onFulfill;
113113
}
114114

115-
public OnReject getOnReject() {
115+
protected OnReject getOnReject() {
116116
return onReject;
117117
}
118118

119-
public PromiseStatus getStatus() {
119+
protected PromiseStatus getStatus() {
120120
return status;
121121
}
122122

123-
public void setStatus(PromiseStatus status) {
123+
protected void setStatus(PromiseStatus status) {
124124
this.status = status;
125125
}
126126
}

src/main/java/cn/hackingwu/promise/PromiseStatus.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.hackingwu.promise;
22

33
/**
4+
* 标识Promise对象的三个状态,PENDING表示正在执行中,FULFILLED表示已经成功执行完成,REJECTED表示已经执行失败.
45
* @author hackingwu.
56
* @since 2016/3/8.
67
*/

0 commit comments

Comments
 (0)