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

com.tinkerpop.frames.util.Validate Maven / Gradle / Ivy

Go to download

Windup Frames is an extension of the upstream Frames project, with tools to ease debugging and integration within windup.

There is a newer version: 4.0.1.Final
Show newest version
package com.tinkerpop.frames.util;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

/**
 * Helper methods for validating input parameters and state.
 */
public final class Validate {
	public static void assertArgument(boolean assertionResult, String message, Object... args) {
		if (!assertionResult)
			throw new IllegalArgumentException(format(message, args));
	}
	
	public static void assertNotNull(Object... args) {
		for (Object arg: args)
			if (arg == null)
				throw new NullPointerException();
	}
	
	public static String format(String message, Object... args) {
		ByteArrayOutputStream msgStream = new ByteArrayOutputStream();
		new PrintStream(msgStream, true).printf(message, args);
		return msgStream.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy