Uploaded image for project: 'Solder'
  1. Solder
  2. SOLDER-12

Add isMetadataChanged() accessor to AnnotatedTypeBuilder

    Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0.Beta1
    • Fix Version/s: Future
    • Component/s: Builders
    • Labels:
      None
    • Affects:
      Documentation (Ref Guide, User Guide, etc.)
    • Estimated Difficulty:
      Low

      Description

      As an optimization, it makes sense to only create the AnnotatedType and assign it to ProcessAnnotatedType if the metadata has changed in anyway. Otherwise, you are wrapping the type just for the sake of wrapping it.

      Therefore, I propose that any change to the state of the annotated type be tracked by a changed flag that is accessible by calling the AnnotatedTypeBuilder#isMetadataChanged() (or similarly named) method. It would be used as follows:

      AnnotatedTypeBuilder b = AnnotatedTypeBuilder.readFromType(event.getAnnotatedType(), true);

      // do extension logic

      if (b.isMetadataChanged())

      { event.setAnnotatedType(b.create()); }

        Gliffy Diagrams

          Activity

          Hide
          dan.j.allen Dan Allen added a comment - - edited

          By the same token, I think that AnnotatedTypeBuilder should be as lazy as possible with loading its internal state. It should only build up the model as the type is changed, possibly as late as create(). There's no question this API will be used heavily by extension writers and therefore it should try to be as efficient as possible to avoid slowing down the deployment.

          Show
          dan.j.allen Dan Allen added a comment - - edited By the same token, I think that AnnotatedTypeBuilder should be as lazy as possible with loading its internal state. It should only build up the model as the type is changed, possibly as late as create(). There's no question this API will be used heavily by extension writers and therefore it should try to be as efficient as possible to avoid slowing down the deployment.
          Hide
          pmuir Pete Muir added a comment -

          There is no need for this to be visible to the user, it can simply be an internal optimization.

          Show
          pmuir Pete Muir added a comment - There is no need for this to be visible to the user, it can simply be an internal optimization.
          Hide
          dan.j.allen Dan Allen added a comment -

          Ah. I assume you are suggesting that create() simply return the original AnnotatedType if no changes are made.

          Show
          dan.j.allen Dan Allen added a comment - Ah. I assume you are suggesting that create() simply return the original AnnotatedType if no changes are made.

            People

            • Assignee:
              dan.j.allen Dan Allen
              Reporter:
              dan.j.allen Dan Allen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Development