!623 ClassUtil增加判断是否是接口的方法

Merge pull request !623 from 徐希望/v5-dev
This commit is contained in:
Looly 2022-05-23 02:40:32 +00:00 committed by Gitee
commit 84f0edcd15
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 31 additions and 0 deletions

View File

@ -1110,4 +1110,24 @@ public class ClassUtil {
}
return location.getPath();
}
/**
* 是否为抽象类或接口
*
* @param clazz
* @return 是否为抽象类或接口
*/
public static boolean isAbstractOrInterface(Class<?> clazz) {
return isAbstract(clazz) || isInterface(clazz);
}
/**
* 是否为接口
*
* @param clazz
* @return 是否为接口
*/
public static boolean isInterface(Class<?> clazz) {
return clazz.isInterface();
}
}

View File

@ -2766,4 +2766,15 @@ public class NumberUtil {
}
}
// ------------------------------------------------------------------------------------------- Private method end
/**
* null转换为BigDecimal<br>
*
* @param bigDecimal 被转换的值
* @return BigDecimal
* @since 5.8.2
*/
public static BigDecimal nullToZero(BigDecimal bigDecimal) {
return bigDecimal == null ? BigDecimal.ZERO : bigDecimal;
}
}