Skip to content

Commit a7150bc

Browse files
committed
规范范型的使用
1 parent a5ed3d3 commit a7150bc

9 files changed

Lines changed: 50 additions & 9 deletions

File tree

flow/src/main/java/org/bekit/flow/event/DecidedNodeEvent.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
* 节点选择事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class DecidedNodeEvent {
2120
// 流程名称
21+
@Getter
2222
private final String flow;
2323
// 被选择的节点
24+
@Getter
2425
private final String node;
2526
// 流程上下文
2627
private final FlowContext<?> context;
28+
29+
public <T> FlowContext<T> getContext() {
30+
return (FlowContext<T>) context;
31+
}
2732
}

flow/src/main/java/org/bekit/flow/event/DecidedStateNodeEvent.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
* 状态节点选择事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class DecidedStateNodeEvent {
2120
// 流程名称
21+
@Getter
2222
private final String flow;
2323
// 被选择的状态节点
24+
@Getter
2425
private final String stateNode;
2526
// 流程上下文
2627
private final FlowContext<?> context;
28+
29+
public <T> FlowContext<T> getContext() {
30+
return (FlowContext<T>) context;
31+
}
2732
}

flow/src/main/java/org/bekit/flow/event/ExecutingNodeEvent.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
* 正在执行的节点事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class ExecutingNodeEvent {
2120
// 流程名称
21+
@Getter
2222
private final String flow;
2323
// 被选择的节点
24+
@Getter
2425
private final String node;
2526
// 流程上下文
2627
private final FlowContext<?> context;
28+
29+
public <T> FlowContext<T> getContext() {
30+
return (FlowContext<T>) context;
31+
}
2732
}

flow/src/main/java/org/bekit/flow/event/FlowEndEvent.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
* 流程结束事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class FlowEndEvent {
2120
// 流程名称
21+
@Getter
2222
private final String flow;
2323
// 流程上下文
2424
private final FlowContext<?> context;
25+
26+
public <T> FlowContext<T> getContext() {
27+
return (FlowContext<T>) context;
28+
}
2529
}

flow/src/main/java/org/bekit/flow/event/FlowExceptionEvent.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
* 流程异常事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class FlowExceptionEvent {
2120
// 流程名称
21+
@Getter
2222
private final String flow;
2323
// 发生的异常
24+
@Getter
2425
private final Throwable throwable;
2526
// 流程上下文
2627
private final FlowContext<?> context;
28+
29+
public <T> FlowContext<T> getContext() {
30+
return (FlowContext<T>) context;
31+
}
2732
}

flow/src/main/java/org/bekit/flow/event/FlowStartEvent.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
* 流程开始事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class FlowStartEvent {
2120
// 流程名称
21+
@Getter
2222
private final String flow;
2323
// 流程上下文
2424
private final FlowContext<?> context;
25+
26+
public <T> FlowContext<T> getContext() {
27+
return (FlowContext<T>) context;
28+
}
2529
}

service/src/main/java/org/bekit/service/event/ServiceApplyEvent.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
* 服务申请事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class ServiceApplyEvent {
2120
// 服务名称
21+
@Getter
2222
private final String service;
2323
// 服务上下文
2424
private final ServiceContext<?, ?> context;
25+
26+
public <O, R> ServiceContext<O, R> getContext() {
27+
return (ServiceContext<O, R>) context;
28+
}
2529
}

service/src/main/java/org/bekit/service/event/ServiceExceptionEvent.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
* 服务异常事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class ServiceExceptionEvent {
2120
// 服务名称
21+
@Getter
2222
private final String service;
2323
// 发生的异常
24+
@Getter
2425
private final Throwable throwable;
2526
// 服务上下文
2627
private final ServiceContext<?, ?> context;
28+
29+
public <O, R> ServiceContext<O, R> getContext() {
30+
return (ServiceContext<O, R>) context;
31+
}
2732
}

service/src/main/java/org/bekit/service/event/ServiceFinishEvent.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
* 服务完成事件
1717
*/
1818
@AllArgsConstructor
19-
@Getter
2019
public class ServiceFinishEvent {
2120
// 服务名称
21+
@Getter
2222
private final String service;
2323
// 服务上下文
2424
private final ServiceContext<?, ?> context;
25+
26+
public <O, R> ServiceContext<O, R> getContext() {
27+
return (ServiceContext<O, R>) context;
28+
}
2529
}

0 commit comments

Comments
 (0)