This chapter introduces utilities that augment the
Java 2 Standard
Edition (J2SE), providing classes and
utilities that make some of the more mundane programming tasks more
straightforward. Jakarta Commons Lang is a collection of useful
supplements to the J2SE. This package fills gaps present in the
standard Java API and provides a number of simple, time-saving
utility classes. Sun’s Javadoc for the
java.lang
package in the J2SE states that the
package “provides classes that are fundamental to
the design of the Java programming language.” In the
same vein, Jakarta Commons Lang provides classes that augment the
fundamental design of the Java programming language.
You may be tempted to skip the simple recipes presented in this
chapter and continue on to more advanced topics in this text. String
manipulation, date truncation, and toString( )
methods do not inspire the sense of mystery and genius one feels when
working with Extensible Markup
Language (XML) or an open source text-to-speech engine.
But, even if you are the most fluent speaker of Java, there are
lessons to be learned from the utilities introduced in this chapter;
a simple trick learned here may save you a few minutes every single
day. Don’t waste your time rewriting and maintaining
utilities that already exist in Commons Lang; there are more
interesting problems to be solved, and building hashcode()
functions is not one of them.
The Advent of Tiger
With the release of Tiger (the codename for Java 1.5), some of these utilities are duplicated or superseded. Those of you who are stuck with 1.4 for a few more months will find some of the supplements in this chapter helpful, regardless of the availability of a new Java Virtual Machine (JVM). Even if you are using Java 1.5, the recipes in this chapter will still be relevant. A few classes in many Jakarta Commons projects have been made obsolete by the release of 1.4, but there are still many vocal users who are using an application that only runs in 1.3 (or even 1.2). The bar for backward compatibility will eventually shift, but for now, most Commons components work with 1.3 or 1.4 at a minimum.
18.119.104.95