List of usage examples for com.fasterxml.jackson.core.type TypeReference TypeReference
protected TypeReference()
From source file:org.redisson.spring.cache.CacheConfigSupport.java
public Map<String, CacheConfig> fromJSON(String content) throws IOException { return jsonMapper.readValue(content, new TypeReference<Map<String, CacheConfig>>() { });// w w w .ja v a 2 s. c o m }
From source file:com.quantiply.samza.serde.JSONStringSerde.java
@Override public Object fromString(String msg) throws Exception { TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() { };/*from w ww. j av a 2 s. c om*/ return _mapper.readValue(msg, typeRef); }
From source file:org.springframework.social.linkedin.api.impl.json.StringListDeserializer.java
public List<String> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { return DeserializationUtils.deserializeFromDataNode(jp, ctxt, "values", new TypeReference<List<String>>() { });//from w w w. ja v a2 s.com }
From source file:com.github.nmorel.gwtjackson.jackson.annotations.JsonRawValueJacksonTest.java
@Test public void testSimpleStringGetter() { JsonRawValueTester.INSTANCE.testSimpleStringGetter(createMapper(new TypeReference<ClassGetter<String>>() { })); }
From source file:com.anrisoftware.simplerest.owncloudocs.ShareResultParseJsonResponse.java
protected ShareResultParseJsonResponse() { super("ocs", new TypeReference<Map<String, DefaultShareResultMessage>>() { }); }
From source file:com.github.nmorel.gwtjackson.jackson.advanced.GenericsAndInheritanceJacksonTest.java
@Test @Ignore public void test() { GenericsAndInheritanceTester.INSTANCE.test(createMapper(new TypeReference<Result<Integer>[]>() { })); }
From source file:com.sg2net.utilities.ListaCAP.json.JsonUtilties.java
public static Collection<Comune> deserializeFrom(File file) { if (file == null) { throw new IllegalArgumentException("File is null"); }//from w w w . j a v a 2 s .c o m if (!file.exists() || file.isDirectory() || !file.canRead()) { throw new IllegalArgumentException("File " + file.getName() + " is not file or is not readable "); } try { return JSONMapper.readValue(file, new TypeReference<List<Comune>>() { }); } catch (IOException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } }
From source file:org.agorava.linkedin.jackson.StringListDeserializer.java
@Override public List<String> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { return DeserializationUtils.deserializeFromDataNode(jp, ctxt, "values", new TypeReference<List<String>>() { });/*from w w w .j a va2 s. com*/ }
From source file:es.logongas.iothome.agent.storage.Storage.java
public List<Measure> get() { List<Measure> measures; InputStream inputStream = null; try {//from w ww. java 2s.c om inputStream = new BufferedInputStream(new FileInputStream(fileName)); measures = (List<Measure>) objectMapper.readValue(inputStream, new TypeReference<ArrayList<Measure>>() { }); if (measures == null) { measures = new ArrayList<Measure>(); } return measures; } catch (FileNotFoundException ex) { //Si no est el fichero simplemente retornamos un nuevo array vacio return new ArrayList<Measure>(); } catch (Exception ex) { throw new RuntimeException(ex); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException ex) { Logger.getLogger(Storage.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:retsys.client.json.JsonHelper.java
public Map<String, Object> getJsonMap(String jsonString) { Map<String, Object> jsonMap = new HashMap<String, Object>(); try {//from w w w . ja v a 2 s . co m jsonMap = mapper.readValue(jsonString, new TypeReference<HashMap<String, Object>>() { }); } catch (Exception e) { e.printStackTrace(); } return jsonMap; }