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

io.leopard.commons.utility.ClassUtil Maven / Gradle / Ivy

There is a newer version: 0.9.12
Show newest version
package io.leopard.commons.utility;

import io.leopard.core.exception.ClassNotFoundRuntimeException;

public class ClassUtil {
	public static Class forName(String className) {
		try {
			return Class.forName(className);
		}
		catch (ClassNotFoundException e) {
			throw new ClassNotFoundRuntimeException(e.getMessage(), e);
		}
	}

	public static boolean exist(String className) {
		try {
			Class.forName(className);
			return true;
		}
		catch (ClassNotFoundException e) {
			return false;
		}
	}

	public static  T newInstance(Class clazz) {
		try {
			return clazz.newInstance();
		}
		catch (Exception e) {
			throw new RuntimeException(e.getMessage(), e);
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy