allow to change resolve strategy on jsonbuilder
This commit is contained in:
parent
b49a1c441c
commit
9c1f2fdec5
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue