io.github.util.GenericityUtils Maven / Gradle / Ivy
The newest version!
package io.github.util;
/**
* Genius
**/
// 泛型工具类
public class GenericityUtils {
// 判断对象是否是某个类的实例
public static boolean instanceofFunc(Object obj,Class b){
boolean result;
if (obj == null) {
result = false;
} else {
try {
T temp=b.cast(obj);
// T temp= (T) obj; // checkcast
result = true;
} catch (ClassCastException e) {
result = false;
}
}
return result;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy