notes/pl/groovy/groovy-pogo.txt
Ihar Hancharenka 5dff80e88e first
2023-03-27 16:52:17 +03:00

18 строки
357 B
Plaintext

by default in groovy:
attributes - are private
methods - are public
classes - are public
class Person {
String first
String last
}
Person qb = new Person()
qb.setFirst('Tom')
qb.last = 'Brady' // use auto-generated setLast-method, unless the prop is private
println "${qb.getFirst()} ${qb.last}"
...
new Person(first: 'Tom', last: 'Brady')