Clean-up and minor changes in core classes.

Adapted new code style.
No or few functional changes.
This commit is contained in:
Harald Kuhr
2011-02-16 22:29:23 +01:00
parent df0d3f90e8
commit 191643a36c
16 changed files with 298 additions and 127 deletions
@@ -16,6 +16,8 @@ import java.util.Map;
* @version $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/lang/Validate.java#1 $
*/
public final class Validate {
// TODO: Make it possible to throw IllegalStateException instead of IllegalArgumentException?
private static final String UNSPECIFIED_PARAM_NAME = "method parameter";
private Validate() {}
@@ -121,4 +123,16 @@ public final class Validate {
return pParameter;
}
public static boolean isTrue(final boolean pExpression, final String pMessage) {
return isTrue(pExpression, pExpression, pMessage);
}
public static <T> T isTrue(final boolean condition, final T value, final String message) {
if (!condition) {
throw new IllegalArgumentException(String.format(message, value));
}
return value;
}
}