Hi,
In my grails app I have an outer command object that contains a list of other command objects:
public class OuterCommand {
List<InnerCommand> innerCommands = ListUtils.lazyList([], FactoryUtils.instantiateFactory(InnerCommand))
}
class InnerCommand {
String code
Long id
String value
static constraints = {
code(nullable: false, blank: false)
value(nullable: false, blank: false)
}
}
The rather unusual instantiation of innerCommands
is based on this advice. However, I find that if I call validate()
on an instance of OuterCommand
, the validation does not seem to validate the contained instances of InnerCommand
.
Is it possible to nest command objects and have the entire graph of command objects validated when validate()
is called on the outermost object?
Thanks, Don