Originally posted by Himanshu Gupta:
This looks too much like
Java code!
Try something more like this:
Specifically, there are two Groovy language features that
you should take advantage of.
1. Automatic getters and setters, or
Groovy Beans. No need to defined those methods, or call them. Groovy provides them for you.
2. In Groovy, there is a feature called
named parameters. This allows you to pass the names of the properties you want to set into the constructor of an object. You can do this with any method, even when calling a Java api.