SideEffects can be either typed or generic, just like Concerns. In the typed case we are interested in specifying SideEffects for one or more particular methods, whereas in the generic case the SideEffect is not really relying on what method is being invoked. Both are useful in different scenarios.
The easiest way to implement a typed SideEffect is to subclass the SideEffectOf class. This gives you access to the result of the real method invocation by using the "next" field, which has the same type as the interface of the method you want the code to be a side-effect of. Note that calling "next" does not actually do anything, it only returns the value (or throws the exception, if one was thrown from the original method) that has already been computed. Similarly, since the method is already done, you can return anything from the SideEffect method. The framework will simply throw it away, and also ignore any exceptions that you throw in your code.
To declare that the SideEffect should be used you add the @SideEffects annotation to either the Composite type, the Mixin type, or the Mixin implementation. Either works.
Steps for this tutorial:
If you have successfully completed the task, you should end up with the following artifacts;
HelloWorld.java
HelloWorldBehaviour.java
HelloWorldBehaviourMixin.java
HelloWorldBehaviourSideEffect.java
HelloWorldCacheInvalidationSideEffect.java
HelloWorldComposite.java
HelloWorldState.java
HelloWorldStateMixin.java