You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2015/10/19 16:49:05 UTC

[jira] [Created] (GROOVY-7638) it should be possible to control whether to execute the closure before or after adding it to the parent

Jochen Kemnade created GROOVY-7638:
--------------------------------------

             Summary: it should be possible to control whether to execute the closure before or after adding it to the parent
                 Key: GROOVY-7638
                 URL: https://issues.apache.org/jira/browse/GROOVY-7638
             Project: Groovy
          Issue Type: Improvement
    Affects Versions: 2.4.5
            Reporter: Jochen Kemnade


I have a builder that validates nodes when they are inserted into the "tree".
{noformat}
builder.with {
  node {
    node2 {
      requiredChild()
    }
  }
}
{noformat}
If I add node2 before adding requiredChild, the validation will fail. That means I'll have to have the closure called before the call to {{setParent}}. Currently. that means I'll have to override the whole {{doInvokeMethod}} method. It would be nice if I only had to override a smaller portion of {{BuilderSupport}} or pass some configuration to the {{BuilderSupport}} constructor.
I can create a patch but I'd like to know which approach I should use.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)