Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1868

Modify BuilderSupport to allow sub-class to change the node at node completion.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.1-beta-2
    • None
    • None
    • All
    • Patch

    Description

      Sometimes you have to process all the child nodes, before you can construct the
      target node for the markup element. Right now, builder support requires this construction
      within the createNode method, and once constructed this node is immutable.

      What is proposed is either modify nodeCompleted to return an Object or to
      add a new method executed after nodeCompleted that allows the
      sub-class to assign a new node to represent the markup element.

      The issue is that nodeCompleted is currently used in sub-class'd builders so a change
      to it's method signature would have an impact on these builders.

      So what is recommended is to add a new method right after nodeCompleted called
      postProcessNode and its method signature would be:

      protected Object postNodeCompleted (Object parent, Object node)

      the default implementation would be:

      protected Object postNodeCompletion( parent, Object node) {
      return node;
      }

      The nodeCompleted method should be deprecated, with reference to the new method, postNodeCompletion.

      eventually nodeCompleted signature can be changed to match postNodeCompletion.

      Attachments

        1. BuilderSupport.patch
          0.9 kB
          James Clarke

        Activity

          People

            blackdrag Jochen Theodorou
            jclarke James Clarke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: