forked from apache/commons-lang
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
struberg edited this page Sep 13, 2010
·
5 revisions
This is a forked repository. Have a look at
apache’s commons-lang wiki
for more information.
This fork is for extending commons.lang.Validate with ellipsis notation functions.
An example:
Validate.isTrue(argInt1.intValue > argInt2.intValue,
"param2 actually is {1} but must larger than param1 {0} !", argInt1, argInt2);
The benefit of this approach is that all the really time consuming string operations will be postponed and only been done if and only if the validation fails!
I did a few performance tests, and the same function with using ellipsis only needs 5% of the time of the ‘old’ way of doing string concatenations all the time (regardless if the error will be shown or not) in the callers code.