allow to change resolve strategy on jsonbuilder

This commit is contained in:
kimchy 2010-04-17 19:05:30 +03:00
parent b49a1c441c
commit 9c1f2fdec5
1 changed files with 3 additions and 1 deletions

View File

@ -36,6 +36,8 @@ class JsonBuilder {
static NODE_ELEMENT = "element" static NODE_ELEMENT = "element"
static int rootResolveStrategy = Closure.OWNER_FIRST; // the default
def root def root
def current def current
@ -70,7 +72,7 @@ class JsonBuilder {
private buildRoot(Closure c) { private buildRoot(Closure c) {
c.delegate = this c.delegate = this
c.resolveStrategy = Closure.DELEGATE_FIRST c.resolveStrategy = rootResolveStrategy;
root = [:] root = [:]
current = root current = root
def returnValue = c.call() def returnValue = c.call()