admin
2021-01-27 92f1d85ddc449ce7452f9d52f8b081e6b69c720b
utils/src/main/java/org/yeshi/utils/GsonUtil.java
@@ -1,24 +1,24 @@
package org.yeshi.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class GsonUtil {
   public static String toDFJson(Object obj) {
      return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create()
            .toJson(obj);
   }
   public static String toJson(Object obj) {
      Gson gson = new Gson();
      return gson.toJson(obj);
   }
   public static String toJsonExpose(Object obj) {
      Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
      return gson.toJson(obj);
   }
}
package org.yeshi.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class GsonUtil {
   public static String toDFJson(Object obj) {
      return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create()
            .toJson(obj);
   }
   public static String toJson(Object obj) {
      Gson gson = new Gson();
      return gson.toJson(obj);
   }
   public static String toJsonExpose(Object obj) {
      Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
      return gson.toJson(obj);
   }
}