-
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
6dd95cf
commit 856fc87
Showing
6 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
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,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.fluxtion.example</groupId> | ||
<artifactId>reference-examples</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>generation</artifactId> | ||
<name>reference-example :: generation</name> | ||
|
||
<properties> | ||
<maven.compiler.source>21</maven.compiler.source> | ||
<maven.compiler.target>21</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
</project> |
21 changes: 21 additions & 0 deletions
21
...rence-examples/generation/src/main/java/com/fluxtion/example/reference/ImperativeAdd.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,21 @@ | ||
package com.fluxtion.example.reference; | ||
|
||
import com.fluxtion.compiler.Fluxtion; | ||
import com.fluxtion.runtime.annotations.OnEventHandler; | ||
|
||
public class ImperativeAdd { | ||
|
||
public static class MyNode { | ||
@OnEventHandler | ||
public boolean handleStringEvent(String stringToProcess) { | ||
System.out.println("received:" + stringToProcess); | ||
return true; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
var processor = Fluxtion.interpret(cfg -> cfg.addNode(new MyNode())); | ||
processor.init(); | ||
processor.onEvent("TEST"); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...amples/generation/src/main/java/com/fluxtion/example/reference/ImperativeAddMultiple.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,32 @@ | ||
package com.fluxtion.example.reference; | ||
|
||
import com.fluxtion.compiler.Fluxtion; | ||
import com.fluxtion.runtime.annotations.OnEventHandler; | ||
|
||
public class ImperativeAddMultiple { | ||
|
||
public static class MyNode { | ||
|
||
private final String name; | ||
|
||
public MyNode(String name) { | ||
this.name = name; | ||
} | ||
|
||
@OnEventHandler | ||
public boolean handleStringEvent(String stringToProcess) { | ||
System.out.println(name + " received:" + stringToProcess); | ||
return true; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
var processor = Fluxtion.interpret(cfg -> { | ||
cfg.addNode(new MyNode("node_1")); | ||
cfg.addNode(new MyNode("node_2")); | ||
cfg.addNode(new MyNode("node_3")); | ||
}); | ||
processor.init(); | ||
processor.onEvent("TEST"); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
reference-examples/generation/src/main/java/com/fluxtion/example/reference/ImplicitAdd.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,36 @@ | ||
package com.fluxtion.example.reference; | ||
|
||
import com.fluxtion.compiler.Fluxtion; | ||
import com.fluxtion.runtime.annotations.OnEventHandler; | ||
import com.fluxtion.runtime.annotations.OnTrigger; | ||
|
||
public class ImplicitAdd { | ||
|
||
public static class MyNode { | ||
@OnEventHandler | ||
public boolean handleStringEvent(String stringToProcess) { | ||
System.out.println("MyNode::received:" + stringToProcess); | ||
return true; | ||
} | ||
} | ||
|
||
public static class Root1 { | ||
private final MyNode myNode; | ||
|
||
public Root1(MyNode myNode) { | ||
this.myNode = myNode; | ||
} | ||
|
||
@OnTrigger | ||
public boolean trigger() { | ||
System.out.println("Root1::triggered"); | ||
return true; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
var processor = Fluxtion.interpret(cfg -> cfg.addNode(new Root1(new MyNode()))); | ||
processor.init(); | ||
processor.onEvent("TEST"); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...nce-examples/generation/src/main/java/com/fluxtion/example/reference/SharedReference.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,48 @@ | ||
package com.fluxtion.example.reference; | ||
|
||
import com.fluxtion.compiler.Fluxtion; | ||
import com.fluxtion.runtime.annotations.OnEventHandler; | ||
import com.fluxtion.runtime.annotations.OnTrigger; | ||
|
||
public class SharedReference { | ||
|
||
public static class MyNode { | ||
private final String name; | ||
|
||
public MyNode(String name) { | ||
this.name = name; | ||
} | ||
|
||
@OnEventHandler | ||
public boolean handleStringEvent(String stringToProcess) { | ||
System.out.println(name + "::received:" + stringToProcess); | ||
return true; | ||
} | ||
} | ||
|
||
public static class Root1 { | ||
private final String name; | ||
private final MyNode myNode; | ||
|
||
public Root1(String name, MyNode myNode) { | ||
this.name = name; | ||
this.myNode = myNode; | ||
} | ||
|
||
@OnTrigger | ||
public boolean trigger() { | ||
System.out.println(name + "::triggered"); | ||
return true; | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
var processor = Fluxtion.interpret(cfg -> { | ||
MyNode myNode1 = new MyNode("myNode_1"); | ||
cfg.addNode(new Root1("root_1", myNode1)); | ||
cfg.addNode(new Root1("root_2", myNode1)); | ||
}); | ||
processor.init(); | ||
processor.onEvent("TEST"); | ||
} | ||
} |
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