default SoftenedCacheable<OUT> soften() { return (key, fn) -> { try { return computeIfAbsent(key, fn); } catch (Throwable t) { throw ExceptionSoftener.throwSoftenedException(t); } }; }
public static <T> T convertFromJson(final String jsonString, final JavaType type) { try { return getMapper().readValue(jsonString, type); } catch (final Exception ex) { ExceptionSoftener.throwSoftenedException(ex); } return null; }
public static String serializeToJson(final Object data) { String jsonString = ""; if (data == null) return jsonString; try { jsonString = getMapper().writeValueAsString(data); } catch (final Exception ex) { ExceptionSoftener.throwSoftenedException(ex); } return jsonString; }