List of usage examples for com.fasterxml.jackson.core.type TypeReference TypeReference
protected TypeReference()
From source file:com.github.nmorel.gwtjackson.jackson.advanced.GenericsJacksonTest.java
@Test public void testSerializeString() { GenericsTester.INSTANCE.testSerializeString(createWriter(new TypeReference<GenericOneType<String>>() { })); }
From source file:com.thesett.util.validation.serdes.Serdes.java
public void testJackson() throws IOException { JsonFactory factory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(factory); File from = new File("albumnList.txt"); TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() { };//from www. j ava2s . c o m HashMap<String, Object> o = mapper.readValue(from, typeRef); System.out.println("Got " + o); }
From source file:com.arrow.acs.client.api.ClientApplicationApi.java
public ListResultModel<AccessKeyModel> findAccessKeyByApplicationHid(String hid) { String method = "findAccessKeyByApplicationHid"; try {// w w w. j a va 2s. c om URI uri = buildUri(APPLICATIONS_ROOT_URL + "/" + hid + "/access-keys"); ListResultModel<AccessKeyModel> result = execute(new HttpGet(uri), new TypeReference<ListResultModel<AccessKeyModel>>() { }); if (result != null && isDebugEnabled()) logDebug(method, "access keys found: %s", result.getSize()); return result; } catch (Throwable e) { throw handleException(e); } }
From source file:com.globo.aclapi.client.api.EnvAPI.java
@Override protected Type getType() { return new TypeReference<Environment>() { }.getType(); }
From source file:edu.usf.cutr.open311client.utils.Open311Parser.java
/** * Parses json string result for service list * * @param json string result/*w w w . j ava 2 s . c om*/ * @return ServiceListResponse object */ public static ServiceListResponse parseServices(String json) { if (json == null) { return new ServiceListResponse(); } ObjectMapper om = createObjectMapper(); ArrayList<Service> services; ServiceListResponse slr = new ServiceListResponse(); try { services = om.readValue(json, new TypeReference<ArrayList<Service>>() { }); slr.setServiceList(services); slr.setResultCode(Open311Constants.RESULT_OK); } catch (IOException e) { logger.error(e); } return slr; }
From source file:com.okta.sdk.clients.FactorsAdminApiClient.java
public List<OrgAuthFactor> getOrgFactors() throws IOException { return get(getEncodedPath("/factors"), new TypeReference<List<OrgAuthFactor>>() { });//from ww w . j a v a2 s. c o m }
From source file:uk.co.sdev.async.http.ning.Parallel3CompletableFutureClientTest.java
@Override protected CompletableFuture<List<NewsItem>> getNews() throws IOException { return completableFutureClient.get("http://localhost:9101/news", new TypeReference<List<NewsItem>>() { }).handle(withFallback(Collections.<NewsItem>emptyList())); }
From source file:com.globo.globodns.client.api.ExportAPI.java
@Override protected Type getType() { return new TypeReference<Export>() { }.getType(); }
From source file:de.dfki.asr.compass.rest.serialization.AbstractIDToEntityDeserializer.java
@Override public EntityType deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectCodec oc = jp.getCodec();/* w w w. j av a2 s.c o m*/ Long id = oc.readValue(jp, new TypeReference<Long>() { }); try { return referenceById(id); } catch (EntityNotFoundException e) { throw new IOException("Cannot load from Database", e); } }
From source file:com.ibm.ws.lars.rest.model.RepositoryObjectList.java
protected static List<Map<String, Object>> readJsonState(String json) throws InvalidJsonAssetException { try {/*from ww w. j av a2 s . c om*/ return reader.readValue(json, new TypeReference<List<Map<String, Object>>>() { }); } catch (JsonParseException e) { throw new InvalidJsonAssetException(e); } catch (JsonMappingException e) { throw new InvalidJsonAssetException(e); } catch (IOException e) { // No idea what would cause this. throw new InvalidJsonAssetException(e); } }