at.spardat.xma.util.Assert Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
// @(#) $Id: Assert.java 2089 2007-11-28 13:56:13Z s3460 $
package at.spardat.xma.util;
/**
* To enable assertions as long as 1.4 is not in production.
*
* Usage is as follows:
*
* if (Assert.ON) Assert.check (condition);
*
*/
public class Assert {
/**
* change this if assertions should be checked
* warning: this is changed in the build.xml
*/
public static final boolean ON = false;
/**
* Throws a runtime exception if condition is not true
*
* @param condition the condition to check
*/
public static void check (boolean condition) {
if (!condition)
throw new RuntimeException("assertion failed");
}
private Assert() {
}
}