Java Reference
In-Depth Information
doesn't exist is accessed through an instance. By intercepting those method or property
“missing” failures, developers can provide whatever they want.
One application of this is for Groovy to add methods to existing classes. This is especially
useful when you want to add methods to classes where you cannot change the source code.
As mentioned earlier, Groovy makes extensive use of the existing Java standard libraries. It
does not, however, simply use them as it finds them. In many cases, a range of new meth-
ods has been added to the Java libraries to make them easier and more powerful.
Collectively the set of enhanced Java libraries is known as the Groovy JDK. Groovy has
two sets of Javadoc documentation. One is the Groovy API, which contains information
about the included Groovy libraries. The other is the Groovy JDK, which shows only those
methods and properties that have been added to the standard Java libraries, in order to, as
the saying goes, make them groovier (see figure 4.4 ) .
Figure 4.4. Groovy adds convenience methods to classes in the Java standard library.
For example, Groovy adds many methods to the java.util.Collection interface,
including collect , count , find , findAll , leftShift , max , min , sort , and
 
Search WWH ::




Custom Search