Issue Details (XML | Word | Printable)

Key: GROOVY-1868
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jochen Theodorou
Reporter: Jim Clarke
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

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

Created: 01/May/07 01:25 PM   Updated: 01/Jul/07 02:48 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1-beta-2

Time Tracking:
Not Specified

File Attachments: 1. Text File BuilderSupport.patch (0.9 kB)

Environment: All


 Description  « Hide
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.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jochen Theodorou added a comment - 01/Jul/07 02:48 PM
patch applied, test written