What is this operator after ServletContext in Grails? -
I'm a complete newbie for Groovy / Gray and Java
I have some code in the Bootstrap class Grails I'm following the example and stumbled on a piece of code like this.
class BootStrap {def init = {servletContext -> } Def = =}}
I understand how the sublet contact is reading from other places, but I did not know what kind of operator like dereference -> servletcontonte ? Any help appreciated
In the Java code, def
like Var
and type in object
; So that variable init
to {servletContext -> }
(by placing it on a line for clarity).
This is one stop, and you can call them with other expressions because they block one of the 3 forms of block code {}
block, Arg sign. If no algos are defined (such as to delete down
to shut down) then in fact a code whose name is is
it is in the loop of traditional i As is - you can use a wide name, but if there is no problem, then
this
is equally good in any form, it is automatically generated by the compiler, and If you want to name it, you can not and
. Will exist.
If there are one or more clearly named nomes, then there is no one in it, it is automatic this
, and you need a delimiter between the algorithm and the beginning of the code - this same Which is ->
and it is necessary that everything is on one line (where required) or on many lines, where theoretically a small local shop
Finally, if in fact There is zero logic, for example, like close a simple singer int getFoo () {...}
, you like it and it's called - & gt; The operator says to make it clear that there is no logic (even
not
): def fooGetter = {- & gt; ...}
Comments
Post a Comment