grails - I'm getting a NullPointerException when accessing static constraints -
the code
${personrequest.constraints.requeststatus.inlist}
in gsp file throws nullpointerexception
, new personrequest().constraints..
works. why? isn't constraints
static?
copied here (grails-user mailing list)
but why accesing static fields doesnt work?
because "constraints" static field closure property. has no sub-properties relating constraints.
grails evaluates closure using constraint builder monitors "calls" methods don't exist, i.e. property names use:
type( inlist: [xxxxx])
...causes method call "type" map parameter containing "inlist" ==> value.
from info, grails builds list of constraints
available , binds them future instances of domain class.so, when access user.constraints statically, getting a
closure.we -could- @ replacing value of static constraints property @ runtime after evaluating closure initialized with. bit "too much" magic. people think?
fyi it's because until 0.4 (if recall) constraints weren't static, , in 0.4 can still non-static. in 0.5
throw exception/ignore non-static constraints.
Comments
Post a Comment