import groovy.transform.Canonical
@Canonical
class Task {
String name
int priority
Date startDate
Date endDate
boolean completed
}
--------------------------------------------------------------------------------------
GroovyBeans are Groovy's version of JavaBeans.
Groovy implicitly generates getters and setters.
class AGroovyBean {
String color
}
def myGroovyBean = new AGroovyBean()
myGroovyBean.setColor('baby blue')
assert myGroovyBean.getColor() == 'baby blue'
myGroovyBean.color = 'pewter'
assert myGroovyBean.color == 'pewter'
No comments:
Post a Comment