You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, is it possible to have the trigger firing be more strongly typed/parameterised?
Specifically - to the params provided. It would be nice to force using of a certain number and type of args for a particular trigger. As I understand, currently I can 'fire' with or without any params. I then need to deal with that in my onEntryBlocks
I had a think about how you might achieve this:
After making a TriggerWithParameters - you call a method on it to generate a concrete instance of the trigger. I.e. you have a trigger factory of sorts that you use to get triggers when firing events. This way, you can only fire an event if you made a trigger the 'right' way.
Use a reflection method similar to Retrofit. Supply an interface of events that is parsed down into TriggerWithParameters objects. This might be a Java 8 only option because to configure the onEntryBlock you might have to use a method refs to identify the event methods.
The text was updated successfully, but these errors were encountered:
Update: I've just found the setTriggerParameters method which allows what I proposed in option 1. This might be a good case for some more example code/docs.
Perhaps making the constructor of TriggerWithParameters package-private might help - I was instantiating one myself, which I don't think is the intended use...
Hi, is it possible to have the trigger firing be more strongly typed/parameterised?
Specifically - to the params provided. It would be nice to force using of a certain number and type of args for a particular trigger. As I understand, currently I can 'fire' with or without any params. I then need to deal with that in my onEntryBlocks
I had a think about how you might achieve this:
TriggerWithParameters
- you call a method on it to generate a concrete instance of the trigger. I.e. you have a trigger factory of sorts that you use to get triggers when firing events. This way, you can only fire an event if you made a trigger the 'right' way.TriggerWithParameters
objects. This might be a Java 8 only option because to configure the onEntryBlock you might have to use a method refs to identify the event methods.The text was updated successfully, but these errors were encountered: