Chapter 10. Lang


Almost every development project winds up with a lot of strange little utility functions, often buried in a class named something like "Utils." Common examples include a utility function for escaping a bit of HTML or SQL, or a quick class to make it easier to return a Date object formatted to a particular locale. The Lang package is essentially a fifty-odd set of these utilities.

The difficult thing about the Lang package is not any particular complexity, but rather simply remembering what functionality is present. In this chapter, we provide a general overview of the Lang package. It may seem easy to write your own utility methods, but those thirty minute one-offs can start to add upand other developers familiar with the Lang package will immediately know where to find and how to use those utility routines.

The Lang package is split up into six main packages:

org.apache.commons.lang

A wide variety of miscellaneous routines.

org.apache.commons.lang.builder

Assists in creating consistent equals(Object), toString(), hashCode(), and compareTo(Object) methods.

org.apache.commons.lang.enum

Support for type-safe Java enums.

org.apache.commons.lang.exception

Provides JDK 1.4 style nested exceptions on earlier versions of the JDK.

org.apache.commons.lang.math

Fractions, ranges, random numbers, and some additional math-related utilities.

org.apache.commons.lang.time

Formatting, stopwatch, and a variety of other time-related utilities.




    Apache Jakarta Commons(c) Reusable Java Components
    Real World Web Services
    ISBN: N/A
    EAN: 2147483647
    Year: 2006
    Pages: 137
    Authors: Will Iverson

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net