This commit is contained in:
duteliang
2024-01-31 00:07:11 +08:00
parent bc1d9a3e60
commit 377e343ee7
93 changed files with 81 additions and 81 deletions

View File

@@ -0,0 +1,51 @@
package com.ruoyi.common.utils;
import java.math.BigDecimal;
public class MapGetUtil {
public static Long getLong(Object obj){
return getLong(obj,null);
}
public static Long getLong(Object obj, Long defaultValue){
if(obj == null){
return defaultValue;
}
return Long.valueOf(obj.toString());
}
public static String getString(Object obj){
if(obj == null){
return null;
}
return String.valueOf(obj);
}
public static Integer getInt(Object obj){
if(obj == null){
return null;
}
return Integer.valueOf(obj.toString());
}
public static BigDecimal getBigDecimal(Object obj){
if(obj == null){
return null;
}
return new BigDecimal(obj.toString());
}
public static Boolean getBoolean(Object obj) {
if(obj == null){
return null;
}
if(obj instanceof Boolean){
return (Boolean)obj;
}
String str = String.valueOf(obj);
return str.equals("true");
}
}