Groovy: различия между версиями
Содержимое удалено Содержимое добавлено
Moriline (обсуждение | вклад) |
Moriline (обсуждение | вклад) |
||
Строка 331:
<syntaxhighlight lang="groovy">
public class ClassWithClosure {
private int member = 20
private String method()
{
return "hello"
}
def publicMethodWithClosure(String name_)
{
def localVar = member + 5
def localVar2 = "Parameter: ${name_}"
return {
Строка 349:
}
ClassWithClosure sample = new ClassWithClosure()
def closureVar = sample.publicMethodWithClosure("Xavier")
closureVar()
</syntaxhighlight>
|