Пример #1
0
 default SoftenedCacheable<OUT> soften() {
   return (key, fn) -> {
     try {
       return computeIfAbsent(key, fn);
     } catch (Throwable t) {
       throw ExceptionSoftener.throwSoftenedException(t);
     }
   };
 }
Пример #2
0
  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;
  }
Пример #3
0
 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;
 }