Der komplette Absatz zu dem Thema: http://docs.codehaus.org/display/GROOVY ... cLanguagesIf your command chain contains an odd number of elements, the chain will be composed of method / arguments, and will finish by a final property access:Code: Alles auswählen
take 3 cookies // equivalent to: take(3).cookies // and also this: take(3).getCookies()
Ist m.E. eine spannende Sache, mal zu sehen, wie sich die Syntax in der Praxis hinsichtlich Lesbarkeit und Intuitivität verhält, d.h. wie das ganze angenommen wird. Vielleicht probiere ich es beizeiten mal selber aus.
Habe weiter unten auf der Seite noch was in der Art gefunden (keine Ahnung, ob die Syntax in früheren Versionen so ging):
Schon cool, weil man sich nach etwas Einarbeitung IMHO schnell dran gewöhnt und Ergebnisse erhält, die man erwartet.Parsing JSON data structures is one thing, but we should also be able to produce JSON content just like we create markup with the MarkupBuilder. The following example:
Will create the JSON output:Code: Alles auswählen
import groovy.json.* def json = new JsonBuilder() json.person { name "Guillaume" age 33 pets "Hector", "Felix" } println json.toString()
Code: Alles auswählen
{"person":{"name":"Guillaume","age":33,"pets":["Hector","Felix"]}}