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

Rethink, who shall manage Lifecycles of DomainObjects, ViewModels and Mixins

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Resolved
    • None
    • 2.0.0-M4
    • Core
    • None

    Description

      1) Document and annotate @DomainObject, @ViewModel and @Mixin with @Scope(SCOPE_PROTOTYPE)
      2) FactoryService#instantiate needs a semantic update

      We want Spring to discover these types from the classpath (so that we can build the metamodel eagerly), but we don't want it to manage them, or do we?

      Using @Scope(PROTOTYPE) is the closest we can come to expressing that without (attempting to) define a custom scope for each of these three types., analogous to factoryService#instantiate for transient objects.

      In practical terms, inventing a custom "entity" scope is probably impossible due to DN's design (the enhancer creates a dnNewInstance method and this is called upon as a factory).

      Instead, then, we "veto" any of these domain types so that Spring is NOT allowed to instantiate any of them.

      The docs should be updated to explain what we're doing here.

      Attachments

        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:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment