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

Simplify syntax way for mixins, to better express intent using @Action, @Collection and @Property

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Implemented
    • 1.16.2
    • 2.0.0-M3
    • None
    • None

    Description

      For regular action mixins, we currently write:

       

      @Mixin(method="act")
      public class Contributee_someAction() {
      
          private final Contributee contributee;  // constructor omitted
          @Action(...)
          @ActionLayout(...)
          public ReturnValue act(.... ) { ... }
      }
      

      instead, the proposal is:

      @Action(...)              // presence of Action on class implies this is a mixin; 
      @ActionLayout(...)
      public class Contributee_someAction() {
          private final Contributee contributee;
          public ReturnValue act( ... ) { ... }   // no need for annotations here.   "act" assumed
      }
      

      The details of the @Action and @ActionLayout facets are "copied" down to the "act" method.

      for properties, we currently write:

      @Mixin(method="prop")
      public class Contributee_someProperty() {
          private final Contributee contributee;  
          @Action(semantics=SAFE)   // required
          @ActionLayout(contributed=ASSOCIATION)  // required
          @Property(...)
          @PropertyLayout(...)
          public ReturnValue prop( /* no args */ ) { ... }
      }
      

      instead we'd rather write:

      @Property(...)     // implies this class is a mixin
      @PropertyLayout(...)
      public class Contributee_someProperty()
          private final Contributee contributee;
          public ReturnValue prop() { ... }                    // "prop" is assumed
      }
      

      The boilerplate (and confusing) @Action(SAFE) and @ActionLayout(AS_ASSOCIATION) are implied. The facets from @Property and @PropertyLayout are copied down to the "prop" method

      And finally, for collections, we currently write:

      @Mixin(method="coll")
      public class Contributee_someCollection() {
          private final Contributee contributee;  
          @Action(semantics=SAFE)   // required
          @ActionLayout(contributed=ASSOCIATION)  // required
          @Collection(...)
          @CollectionLayout(...)
          public List<ReturnValue> coll( /* no args */ ) { ... }
      }
      

      instead we'd rather write:

      @Collection(...)     // implies this class is a mixin
      @CollectionLayout(...)
      public class Contributee_someCollection()
          private final Contributee contributee;
          public List<ReturnValue> coll() { ... }                    // "coll" is assumed
      }
      

      similar to properties.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            hobrom Andi Huber
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment