Skip to content

Commit

Permalink
added some binding examples
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-higgins committed Mar 17, 2024
1 parent 0e2df9a commit 73444ad
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.fluxtion.example.reference;

import com.fluxtion.compiler.Fluxtion;
import com.fluxtion.runtime.annotations.OnEventHandler;
import com.fluxtion.runtime.annotations.builder.Inject;
import com.fluxtion.runtime.node.InstanceSupplier;

import java.util.Date;

public class InjectRuntimeInstance {

public static class MyNode{
@Inject(instanceName = "startData")
public InstanceSupplier<Date> myDate;

@OnEventHandler
public boolean handleStringEvent(String stringToProcess) {
System.out.println("runtime injected:" + myDate.get());
return true;
}
}

public static void main(String[] args) {
var processor = Fluxtion.interpret(new MyNode());
processor.injectNamedInstance(new Date(1000000), "startData");

processor.init();
processor.onEvent("TEST");

processor.injectNamedInstance(new Date(999000000), "startData");
processor.onEvent("TEST");
}

}

0 comments on commit 73444ad

Please sign in to comment.