Unannoyment

Unannoyment is small, public domain library which attempts to make smaller, but frequently occuring code fragments even smaller. Take a look at our API (Javadoc) to see what we mean, or better still, download it for a quick spin!

Keep Garbage Out

The Unannoyment library provides a simple precondition mechanism so that you will program more defensively in Java.

ArgCheck

Wasn't this code a royal pain in the butt to write?

  if (arg == null) {
    String error = "In function 'func', argument 'arg' was null";
    throw new IllegalArgumentException(error);
  }

  if (str == null) {
    String error = "In function 'func', argument 'str' was null";
    throw new IllegalArgumentException(error);
  } else if (str == null) {
    String error = "In function 'func', argument 'str' was empty";
    throw new IllegalArgumentException(error);
  }
With Unannoyment, you say something far simpler:
  ArgCheck.notNull("func", "arg", arg);
  ArgCheck.notNullOrEmpty("func", "str", str);
ArgCheck provides these two simple cases, but it is also extensible for creating other preconditions.

String helpers

How many times have you written the following code? And for all its simplicity, how many times have you written it wrong?
  if (str != null && str.length() > 0)... 
  if (str == null || str.length() == 0)... 
We alse provide a String helper class which helps you produce more readable code:
  if (Str.notNullOrEmpty(str))...
  if (Str.nullOrEmpty(str))...

No More Excuses...

The idea here is to replace something which normally takes 3 or 4 lines of code with one very short line. This sounds pretty trivial they are checks which should happen very frequently. Either people clutter up their code with these checks, or they leave them out and the bugs in their code is harder to track down. Using our library makes the checks so easy to perform, they have no longer any excuse not to use them.

Download

CVS Access

This is if you want the cutting-edge (read: broken) stuff. If you want to improve Unannoyment, we would more than welcome your contribution. Send me an email (kow at loria point fr), and i will add you to the developer list.

  1. cvs -d:pserver:anonymous@unannoy.sourceforge.net:/cvsroot/unannoy login
    (no password, just hit enter)
  2. cvs -z3 -d:pserver:anonymous@cvs.unannoy.sourceforge.net:/cvsroot/unannoy co unannoyment

Alternate Distributions

You could visit our Sourceforge project page for older versions of Unannoyment, or if you want zipfiles instead of tgz

Requirements

Unannoy comes with everything it needs (i.e. nothing). You can use it as a library for all your Java projects.

Notes

The "no more excuses" idea was taken from JUnitDoclet. These guys deserve kudos for their contribution to software quality.


$Id: index.html,v 1.5 2003/08/01 16:07:48 kowey Exp $