java - Notation of the Dynamic Querying Associations -
in latest documentation of grails, can read:
querying associations. associations can used within queries:
def author = author.findbyname("stephen king") def books = author ? book.findallbyauthor(author) : [] i'd know meaning of ? , : []
shorthand if statement in groovy (and java, see first comment).
def books = author ? book.findallbyauthor(author) : [] is equivalent of:
def books if (author) { books = book.findallbyauthor(author) } else { books = [] } see elvis operator (groovy only, not java) here.
Comments
Post a Comment