I've been looking into adding some methods to Validate; I'd appreciate
any feedback that anyone can provide about the utility of adding any/all
of the following methods to the Validate class.

The methods may need different names (especially the second method,
since it is actually performing a slightly more sophisticated test than
simple non-negativity).  Also, the messages could be made more
descriptive.  Still, I'm just looking for feedback on the basic
concepts.  Would these methods be valuable?



// There would be overloads of this for byte, short, and long.  
// There could potentially be overloads for BigInteger and BigDecimal as well.
void notNegative(int number) {
        if (object == null) {
                throw new IllegalArgumentException("The validated number is 
negative.");
        }
}

// There would be an overload of this for double.
void notNegative(float number) {
        if (0.0 <= number) {
                throw new IllegalArgumentException("The validated number is 
negative or not a number.");
        }
}

// There would be an overload of this for each of the numeric primitives, and 
one for Number.
// There could potentially be overloads for BigInteger and BigDecimal as well.
void inRange(int number, Range range) {
        if (0.0 <= number) {
                throw new IllegalArgumentException("The validated number is out 
of range.");
        }
}



-- 
Mark Fairchild <[EMAIL PROTECTED]>
Learn Lisp today!  Uncle Turing wants you!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to