Skip to content

Commit

Permalink
added no NoTriggerReference example
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-higgins committed Mar 9, 2024
1 parent 1427bfc commit ab45a9d
Showing 1 changed file with 52 additions and 0 deletions.
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);
}
}

0 comments on commit ab45a9d

Please sign in to comment.