Java Reference
In-Depth Information
The result is a nice, hyperlinked set of documentation of all the test cases, plus a JAR file
for deployment.
Of course, if there's a plugin called java , there's a plugin called groovy . Better yet, the
Groovy plugin includes the Java plugin and, as usual, augments and improves it. If your
project is similar to the ones discussed in this topic, in that it combines Groovy and Java
classesanduseseachwheremosthelpful,thenallyouneedistheGroovypluginandyou're
ready to go. There are many other plugins available, including eclipse and web . I'll talk
about them in chapter 5 on build processes.
In this section I reviewed several of the features built into Java and how they can lead to
code that's more verbose and complicated than necessary. I demonstrated how Groovy can
streamline implementations and even augment existing Java tools to make them easier to
useandmorepowerful.I'llshowmoredetailsthroughoutthebook.FirstIwanttolistsome
of the additional capabilities Groovy brings to Java in the next section.
1.2. Groovy features that help Java
I've actually been discussing these all along, but let me make a few specific points here.
First, the Groovy version of a Java class is almost always simpler and cleaner. Groovy is
far less verbose and generally easier to read.
As true as that statement is, though, it's a bit misleading. I'm not advocating rewriting all
yourJavacodeinGroovy.Quite thecontrary; ifyourexisting Javacodeworks,that'sgreat,
although you might want to consider adding test cases in Groovy if you don't already have
them. In this topic, I'm more interested in helping Java than replacing it.
What does Groovy offer Java? Here's a short list of topics that are discussed in much more
detail in the rest of the topic:
1 . Groovy adds new capabilities to existing Java classes. Groovy includes a Groovy
JDK, which documents the methods added by Groovy to the Java libraries. The vari-
ous sort methods added to the Collection interface that I used for strings was
a simple example. You can also use Java classes with Groovy and add features like
operator overloading to Java. These and related topics will be discussed in chapter 4 .
Search WWH ::




Custom Search