List of usage examples for com.fasterxml.jackson.core.type TypeReference TypeReference
protected TypeReference()
From source file:app.service.PinService.java
public int getPin(String uid, List<PinData> pinDatas) { User user = new User(); user.setUid(uid);/* w w w . j ava 2 s.co m*/ Pin pin = mPinRepo.findByUser(user); if (pin == null || StringUtils.isEmpty(pin.getPins())) { return BaseResponse.COMMON_SUCCESS; } try { String pins = pin.getPins(); List<PinData> list = mObjectMapper.readValue(pins, new TypeReference<List<PinData>>() { }); for (PinData pinData : list) { long colId = pinData.getCollection().getId(); pinData.setCollection(mColService.findByID(colId)); } pinDatas.addAll(list); } catch (IOException e) { logger.info("parse list-pinData failure", e); return ResultCode.PARSE_PIN_DATA_FAILED; } return BaseResponse.COMMON_SUCCESS; }
From source file:com.okta.sdk.clients.FactorsAdminApiClient.java
public OrgAuthFactor deActivateOrgFactor(String orgAuthFactorId) throws IOException { return post(getEncodedPath("/factors/%s/lifecycle/deactivate", orgAuthFactorId), null, new TypeReference<OrgAuthFactor>() { });//from w w w .j a va 2 s.com }
From source file:fi.helsinki.opintoni.integration.leiki.LeikiMockClient.java
@Override public List<LeikiCourseRecommendation> getCourseRecommendations(String studentNumber) { return getLeikiSearchResponse(courseRecommendationResultsResource, new TypeReference<LeikiResponse<LeikiCourseRecommendation>>() { });/*from w w w . j a va 2 s . c o m*/ }
From source file:no.ssb.jsonstat.v2.DatasetDeserializationTest.java
@Test public void testSsbApi() throws Exception { URL ssb = Resources.getResource(getClass(), "./ssb-api.json"); JsonParser parser = mapper.getFactory().createParser(new BufferedInputStream(ssb.openStream())); // v1 is in a map TypeReference<Map<String, DatasetBuildable>> ref = new TypeReference<Map<String, DatasetBuildable>>() { // just a ref. };//from w w w. j a v a 2s . c o m Map<String, DatasetBuildable> o = mapper.readValue(parser, ref); DatasetBuildable next = o.values().iterator().next(); Dataset build = next.build(); Map<List<String>, Number> listListMap = build.asMap(); for (Map.Entry<List<String>, Number> listListEntry : listListMap.entrySet()) { System.out.println(listListEntry); } }
From source file:com.evrythng.java.wrapper.service.ApplicationService.java
/** * Creates a new {@link Application}//ww w. j av a2 s . co m * <p> * POST {@value #PATH_APPLICATIONS} * * @param projectId project id * @param app : App to create. Customer and Description are mandatory. * @return the app created, including its brand-new "appApiKey" and its id to be used for further call of the service. */ public Builder<Application> applicationCreator(final String projectId, final Application app) throws EvrythngClientException { return post(projectApplications(projectId), app, new TypeReference<Application>() { }); }
From source file:org.springframework.cloud.config.monitor.GitlabPropertyPathNotificationExtractorTests.java
@Test public void nonPushEventNotDetected() throws Exception { // See http://doc.gitlab.com/ee/web_hooks/web_hooks.html#push-events Map<String, Object> value = new ObjectMapper().readValue( new ClassPathResource("gitlab.json").getInputStream(), new TypeReference<Map<String, Object>>() { });/*from w ww .ja v a2 s .c om*/ this.headers.set("X-Gitlab-Event", "Issue Hook"); PropertyPathNotification extracted = this.extractor.extract(this.headers, value); assertNull(extracted); }
From source file:com.github.nmorel.gwtjackson.jackson.advanced.GenericsJacksonTest.java
@Test public void testDeserializeIntegerString() { GenericsTester.INSTANCE//from w ww. java2s . c o m .testDeserializeIntegerString(createReader(new TypeReference<GenericTwoType<Integer, String>>() { })); }
From source file:org.springframework.cloud.config.monitor.CompositePropertyPathNotificationExtractorTests.java
@Test public void gitlabDetected() throws Exception { Map<String, Object> value = new ObjectMapper().readValue( new ClassPathResource("gitlab.json").getInputStream(), new TypeReference<Map<String, Object>>() { });/*from www .j ava2 s. co m*/ this.headers.set("X-Gitlab-Event", "Push Hook"); PropertyPathNotification extracted = this.extractor.extract(this.headers, value); assertNotNull(extracted); String[] paths = extracted.getPaths(); assertThat("paths was wrong", paths, arrayContainingInAnyOrder("oldapp.yml", "newapp.properties", "application.yml")); }
From source file:com.evrythng.java.wrapper.service.UrlBindingService.java
/** * Creates url binding. Qr image is returned. * * @param binding {@link UrlBinding} instance. * * @return a preconfigured {@link Builder}. *//*from w w w . j a v a2 s. c om*/ public Builder<InputStream> bindingCreatorReturnQr(final UrlBinding binding) throws EvrythngClientException { return post(PATH_URLS, binding, Status.OK, new TypeReference<InputStream>() { }).accept("image/png"); }