@Test public void testFromJson2() { String triggeredDataStr = null; assertNull(JsonUtils.fromJson(triggeredDataStr, TriggeredData.class)); triggeredDataStr = "null"; assertNull(JsonUtils.fromJson(triggeredDataStr, TriggeredData.class)); triggeredDataStr = "{}"; assertNotNull(JsonUtils.fromJson(triggeredDataStr, TriggeredData.class)); triggeredDataStr = "abc"; assertNull(JsonUtils.fromJson(triggeredDataStr, TriggeredData.class)); }
public static <T> T fromJson(String json, Type typeOfT) { try { return gson.fromJson(json, typeOfT); } catch (JsonParseException e) { LogUtils.warn(log, LogEvents.ExecutorEvent.COMMON, "json deserialize error", e); return null; } }
JsonUtils { public static <T> T fromJson(String json, Type typeOfT) { try { return gson.fromJson(json, typeOfT); } catch (JsonParseException e) { LogUtils.warn(log, LogEvents.ExecutorEvent.COMMON, "json deserialize error", e); return null; } } }
JsonUtils { public static <T> T fromJson(String json, Type typeOfT) { try { return gson.fromJson(json, typeOfT); } catch (JsonParseException e) { LogUtils.warn(log, LogEvents.ExecutorEvent.COMMON, "json deserialize error", e); return null; } }  }
JsonUtils { public static <T> T fromJson(String json, Type typeOfT) { try { return gson.fromJson(json, typeOfT); } catch (JsonParseException e) { LogUtils.warn(log, LogEvents.ExecutorEvent.COMMON, "json deserialize error", e); return null; } }  static Gson getGson(); static JsonParser getJsonParser(); static String toJson(Object src); static String toJson(Object src, Type typeOfSrc); static T fromJson(String json, Type typeOfT); static T fromJson(String json, Class<T> classOfT); }
JsonUtils { public static <T> T fromJson(String json, Type typeOfT) { try { return gson.fromJson(json, typeOfT); } catch (JsonParseException e) { LogUtils.warn(log, LogEvents.ExecutorEvent.COMMON, "json deserialize error", e); return null; } }  static Gson getGson(); static JsonParser getJsonParser(); static String toJson(Object src); static String toJson(Object src, Type typeOfSrc); static T fromJson(String json, Type typeOfT); static T fromJson(String json, Class<T> classOfT);  }