Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-2329

Support nested non-static mixins, with domain event class declared within.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0-M3
    • 2.0.0-M6
    • None

    Description

      To support this, need to allow action domain events to have 1-arg constructor, being the mixee. 

      eg, at the moment, in simpleapp, I can refactor updateName into a mixin:

      public static class UpdateNameActionDomainEvent 
        extends SimpleModule.ActionDomainEvent<SimpleObject.updateName> { }
      
      @Action(semantics = IDEMPOTENT,
              command = CommandReification.ENABLED, publishing = Publishing.DISABLED,
              associateWith = "name", domainEvent = UpdateNotesActionDomainEvent.class)
      public class updateName {
      
          public SimpleObject act(@Name final String name) {
              setName(name);
              return SimpleObject.this;
          }
      
          public String default0Act() {
              return getName();
          }
      }
       

      but the  UpdateNameActionDomainEvent has to remain outside for now.  Instead, I'd like to write:

      @Action(semantics = IDEMPOTENT,
              command = CommandReification.ENABLED, publishing = Publishing.DISABLED,
              associateWith = "name", domainEvent = UpdateNotesActionDomainEvent.class)
      public class updateName {
      
         public class UpdateNameActionDomainEvent 
           extends SimpleModule.ActionDomainEvent<SimpleObject.updateName> { } 
      
          public SimpleObject act(@Name final String name) {
              setName(name);
              return SimpleObject.this;
          }
      
          public String default0Act() {
              return getName();
          }
      }
       

      The fix should be quite simple: improve the instantiation logic in DomainEventHelper to handle events with 1 arg as well as 0 args and 3 args.

      Attachments

        Issue Links

          Activity

            People

              danhaywood Daniel Keir Haywood
              danhaywood Daniel Keir Haywood
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: