commit
Some checks failed
API接口参数变更检测 / api-param-check (push) Has been cancelled

This commit is contained in:
2026-06-05 16:18:40 +08:00
parent 1ca34c6bb2
commit 3cba3bb74e
4393 changed files with 450030 additions and 103 deletions

View File

@@ -0,0 +1,24 @@
package jnpf.util;
import jnpf.exception.HandleException;
/**
* 数字转换类
*
* @author yanwenfu
* @create 2025-04-17
*/
public class NumberUtils {
public static float safeToFloat(Object obj) throws HandleException {
if (obj instanceof Number) {
Number num = (Number) obj;
return num.floatValue();
}
try {
return Float.parseFloat(String.valueOf(obj));
} catch (NumberFormatException e) {
throw new HandleException("转换失败");
}
}
}