Description
For example, rather than a contributed action:
@DomainService( nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY ) public class CommunicationChannel_updateNotes { @Action( semantics = SemanticsOf.IDEMPOTENT ) public <T extends CommunicationChannel<T>> CommunicationChannel<T> updateNotes( CommunicationChannel<T> communicationChannel, @Parameter(optionality = Optionality.OPTIONAL) @ParameterLayout(named = "Notes", multiLine = 10) final String Notes) { communicationChannel.setNotes(Notes); return communicationChannel; } public <T extends CommunicationChannel<T>> String default1UpdateNotes( CommunicationChannel<T> communicationChannel ) { return communicationChannel.getNotes(); } }
which requires passing in the contributee to every method, and ensuring that all methods are named correctly, we can instead say:
@DomainObject( nature = Nature.MIXIN ) public class CommunicationChannel_updateNotes { private final CommunicationChannel communicationChannel; public CommunicationChannel_updateNotes(CommunicationChannel communicationChannel) { this.communicationChannel = communicationChannel; } @Action( domainEvent = UpdateNotesEvent.class, semantics = SemanticsOf.IDEMPOTENT ) public <T extends CommunicationChannel<T>> CommunicationChannel<T> __( @Parameter(optionality = Optionality.OPTIONAL) @ParameterLayout(named = "Notes", multiLine = 10) final String Notes) { communicationChannel.setNotes(Notes); return communicationChannel; } public <T extends CommunicationChannel<T>> String default0__() { return communicationChannel.getNotes(); } }
where the name of the action is "_" meaning instead infer the action name from the name of the mixin class, and where the mixin has a constructor of the object being mixed in.