-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1427bfc
commit ab45a9d
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...execution/src/main/java/com/fluxtion/example/reference/execution/NonTriggerReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.fluxtion.example.reference.execution; | ||
|
||
import com.fluxtion.compiler.Fluxtion; | ||
import com.fluxtion.runtime.annotations.NoTriggerReference; | ||
import com.fluxtion.runtime.annotations.OnEventHandler; | ||
import com.fluxtion.runtime.annotations.OnTrigger; | ||
|
||
public class NonTriggerReference { | ||
public static class MyNode { | ||
@OnEventHandler | ||
public boolean handleStringEvent(String stringToProcess) { | ||
System.out.println("MyNode::handleStringEvent received:" + stringToProcess); | ||
return true; | ||
} | ||
|
||
} | ||
|
||
public static class MyNode2 { | ||
@OnEventHandler | ||
public boolean handleIntEvent(int intToProcess) { | ||
System.out.println("MyNode2::handleIntEvent received:" + intToProcess); | ||
return true; | ||
} | ||
} | ||
|
||
|
||
public static class Child { | ||
private final MyNode myNode; | ||
@NoTriggerReference | ||
private final MyNode2 myNode2; | ||
|
||
public Child(MyNode myNode, MyNode2 myNode2) { | ||
this.myNode = myNode; | ||
this.myNode2 = myNode2; | ||
} | ||
|
||
|
||
@OnTrigger | ||
public boolean triggered() { | ||
System.out.println("Child:triggered"); | ||
return true; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
var processor = Fluxtion.interpret(new Child(new MyNode(), new MyNode2())); | ||
processor.init(); | ||
processor.onEvent("test"); | ||
System.out.println(); | ||
processor.onEvent(200); | ||
} | ||
} |