-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZeeL2.java
More file actions
61 lines (47 loc) · 940 Bytes
/
Copy pathZeeL2.java
File metadata and controls
61 lines (47 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
public class ZeeL2 {
/**
*
CustomStep.run("cirlce",5);
class CustomStep1 implements DisplayInterface {
Display
public CustomeStep1()
public void display() {
sysout("Step1");
}
}
//
Chain.run()
class mycustomstep1 extends/implements Step {
execute(){
sysout("interview")
}
}
*/
}
interface Step {
public int execute();
default void run(){
//Injected
Step s = new StepOne();
int result = s.execute();
if(result == 0) {
// Call Failure Method
} else if(result == 1) {
// Call Success Method
}
}
}
class StepOne implements Step {
public int execute(Step nextStep) {
sysout("Step1");
return 0;
}
}
class StepTwo implements Step {
public int execute() {
sysout("Step2");
//Business Logic
return 1;
}
}
Step.run();