All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.uhn.hl7v2.hoh.util.Validate Maven / Gradle / Ivy

There is a newer version: 2.5.1
Show newest version
package ca.uhn.hl7v2.hoh.util;

/**
 * Utility class for parameter validation
 *
 */
public abstract class Validate {

	/**
	 * @throws IllegalArgumentException If theObject is null
	 */
	public static void notNull(Object theObject, String theName) {
		assert theName != null;
		
		if (theObject == null) {
			throw new IllegalArgumentException(theName + " can not be null");
		}
	}

	/**
	 * @throws IllegalArgumentException If theObject is null or contains no non-whitespace characters
	 */
	public static void notBlank(String theObject, String theName) {
		assert theName != null;

		if (theObject == null) {
			throw new IllegalArgumentException(theName + " can not be null");
		}
		
		if (theObject.trim().length() == 0) {
			throw new IllegalArgumentException(theName + " can not be empty");
		}
	}
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy