public interface Lib
A function library harkens back to the joyous days of C programming, where you didn't have to have an actual object for every stupid thing you wanted to do. Function libraries may contain convenience methods, factory methods, and other kinds of methods that don't properly belong in a class definition. They also serve as a way to effectively extend the functionality of built-in classes (like java.lang.String) or primitives (e.g. math functions).
All function libraries should implement this marker interface to distinguish them in the API. They should have a no-arg, private constructor to prevent subclassing or instantiation. And they should have a name ending in "Lib" (e.g. RandomLib, StringLib, etc.) to further remind developers of their purpose.
Users of function libraries may wish to make use of the static import facility in Java 1.5 to eliminate the need to refer to the *Lib for each method call. E.g. instead of
<!-- // JAPAN:IGNORE --> import static com.partnersoft.geometry.GeometryLib; ... newAngle = GeometryLib.canonicalAngle(angle)
you can say
<!-- // JAPAN:IGNORE --> import static com.partnersoft.geometry.GeometryLib; ... newAngle = canonicalAngle;
A skeletal implementation is provided in skeletons/SkeletonLib.java for your convenience and pleasure.
Copyright 2006 Partner Software, Inc.