aboutsummaryrefslogtreecommitdiff
path: root/src/Java/miscutil/core/util/ClassUtils.java
blob: 6ea9336006352ae05d9693051d5c62a9d9a1379b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package miscutil.core.util;

public class ClassUtils {

	
	/*@ if (isPresent("com.optionaldependency.DependencyClass")) {
    //  This block will never execute when the dependency is not present
    //  There is therefore no more risk of code throwing NoClassDefFoundException.
    executeCodeLinkingToDependency();
	}*/
	public static boolean isPresent(String className) {
	    try {
	        Class.forName(className);
	        return true;
	    } catch (Throwable ex) {
	        // Class or one of its dependencies is not present...
	        return false;
	    }
	}

	
	
}