| | |
| | | import com.core.common.Cools; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/27 |
| | |
| | | |
| | | } |
| | | |
| | | public static Map<String, Object> objectToMap(Object obj) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Field[] fields = obj.getClass().getDeclaredFields(); |
| | | for (Field field : fields) { |
| | | field.setAccessible(true); // 设置私有字段可访问 |
| | | try { |
| | | map.put(field.getName(), field.get(obj)); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | SlaveProperties slaveProperties = new SlaveProperties(); |
| | | slaveProperties.setDoubleDeep(true); |