mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
045de55b5c
commit
2b0dee29fa
@ -432,6 +432,7 @@ public class PropDesc {
|
||||
* @param getterMethod 读取方法,可为{@code null}
|
||||
* @return 是否为Transient关键字修饰的
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private static boolean isTransientForGet(final Field field, final Method getterMethod) {
|
||||
boolean isTransient = ModifierUtil.hasAny(field, ModifierType.TRANSIENT);
|
||||
|
||||
@ -441,7 +442,13 @@ public class PropDesc {
|
||||
|
||||
// 检查注解
|
||||
if (!isTransient) {
|
||||
isTransient = AnnotationUtil.hasAnnotation(getterMethod, Transient.class);
|
||||
try {
|
||||
// issue#IB0JP5,Android可能无这个类
|
||||
final Class aClass = Class.forName("java.beans.Transient");
|
||||
isTransient = AnnotationUtil.hasAnnotation(getterMethod, aClass);
|
||||
} catch (final ClassNotFoundException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -710,6 +710,21 @@ public class ClassUtil {
|
||||
return location.getPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指定类名的类是否存在
|
||||
*
|
||||
* @param className 全类名
|
||||
* @param loader {@link ClassLoader}
|
||||
* @return 类名的类是否存在
|
||||
*/
|
||||
public static boolean isClassExists(final String className, final ClassLoader loader) {
|
||||
try {
|
||||
return null != forName(className, false, loader);
|
||||
} catch (final Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载指定名称的类,支持:
|
||||
* <ul>
|
||||
|
Loading…
x
Reference in New Issue
Block a user