public static <T> T deSer(String str, Class<T> clazz) throws JSONSerDeException { try { return (T) mapper.readValue(str, clazz); } catch (JsonParseException e) { throw new JSONSerDeException(e); } catch (JsonMappingException e) { throw new JSONSerDeException(e); } catch (IOException e) { throw new JSONSerDeException(e); } } }
@SuppressWarnings("unchecked") public static <T> T deSer(String str, TypeReference<T> ref) throws JSONSerDeException { try { return (T) mapper.readValue(str, ref); } catch(JsonParseException e) { throw new JSONSerDeException(e); } catch(JsonMappingException e) { throw new JSONSerDeException(e); } catch(IOException e) { throw new JSONSerDeException(e); } }
@SuppressWarnings("unchecked") public static <T> T deSer(String str, TypeReference<T> ref) throws JSONSerDeException { try { return (T) mapper.readValue(str, ref); } catch (JsonParseException e) { throw new JSONSerDeException(e); } catch (JsonMappingException e) { throw new JSONSerDeException(e); } catch (IOException e) { throw new JSONSerDeException(e); } }
public static String ser(Object obj) throws JSONSerDeException { try { return mapper.writeValueAsString(obj); } catch (JsonGenerationException e) { throw new JSONSerDeException(e); } catch (JsonMappingException e) { throw new JSONSerDeException(e); } catch (IOException e) { throw new JSONSerDeException(e); } }
public static <T> T deSer(String str, Class<T> clazz) throws JSONSerDeException { try { return (T) mapper.readValue(str, clazz); } catch(JsonParseException e) { throw new JSONSerDeException(e); } catch(JsonMappingException e) { throw new JSONSerDeException(e); } catch(IOException e) { throw new JSONSerDeException(e); } } }
public static String ser(Object obj) throws JSONSerDeException { try { return mapper.writeValueAsString(obj); } catch(JsonGenerationException e) { throw new JSONSerDeException(e); } catch(JsonMappingException e) { throw new JSONSerDeException(e); } catch(IOException e) { throw new JSONSerDeException(e); } }