Java Reference
In-Depth Information
Listing 1.3. A Java class representing a task
We have private fields and public getter and setter methods, along with whatever construct-
ors we need. We also add a typical override of the
toString
method. I could probably
use an override of
equals
and
hashCode
as well, but I left those out for simplicity.
Most of this code can be generated by an IDE, but it still makes for a long listing, and I
haven't added the necessary
equals
and
hashCode
overrides yet. That's a lot of code
for what's essentially a dumb data structure.
The analogous Plain Old Groovy Object (POGO) is shown here: