52 lines
1.1 KiB
Java
52 lines
1.1 KiB
Java
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");
|
|
}
|
|
}
|