public <T> T to(TypeReference<T> typeReference) { try { return Mapper.get().readValue(message, typeReference); } catch (IOException e) { throw new RuntimeException(e); } }
public <T> T to(Class<T> clazz) { try { return Mapper.get().readValue(message, clazz); } catch (IOException e) { throw new RuntimeException(e); } }
@SuppressWarnings("rawtypes") @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } if (contextObject instanceof Map) { Map map = (Map) contextObject; return map.get(name); } if (contextObject instanceof Mapper) { Mapper mapper = (Mapper) contextObject; return mapper.get(name); } return null; }