List of usage examples for com.fasterxml.jackson.core.type TypeReference TypeReference
protected TypeReference()
From source file:org.createnet.raptor.client.model.ActionClient.java
/** * List available actions on the object/*from w ww.jav a 2 s. co m*/ * * @param object reference * @return return the list of available action for an object */ public List<Action> list(ServiceObject object) { List<Action> actions = ServiceObject.getMapper().convertValue( getClient().get(RaptorComponent.format(RaptorClient.Routes.ACTION_LIST, object.id)), new TypeReference<List<Action>>() { }); actions.forEach(action -> { action.setServiceObject(object); }); return actions; }
From source file:com.okta.sdk.clients.FactorsAdminApiClient.java
public List<OrgAuthFactor> getOrgFactors(FilterBuilder filterBuilder) throws IOException { return get(getEncodedPath("/factors?" + FILTER + "=%s", filterBuilder.toString()), new TypeReference<List<OrgAuthFactor>>() { });/*www .j a v a 2 s . c o m*/ }
From source file:com.surfs.storage.block.service.impl.PoolServiceImpl.java
@Override public List<ZpoolInfo> getZpoolInfos() { List<ZpoolInfo> list = new ArrayList<>(); try {//from w w w . jav a 2s. c o m // local String jsonLocal = CmdUtils.executeCmdForString(BlockConstant.BLOCK_POOL_PATH); ObjectMapper objectMapper = new ObjectMapper(); ZpoolInfo infoLocal = objectMapper.readValue(jsonLocal, new TypeReference<ZpoolInfo>() { }); list.add(infoLocal); // remote String jsonRemote = getRemoteStoragePoolJson(); ZpoolInfo infoRemote = objectMapper.readValue(jsonRemote, new TypeReference<ZpoolInfo>() { }); list.add(infoRemote); } catch (Exception e) { LogFactory.error(e.getMessage()); } return list; }
From source file:com.github.nmorel.gwtjackson.jackson.advanced.jsontype.TypeNamesJacksonTest.java
@Test @Ignore("for some reasons, jackson don't add type info. It works on original jackson test with a class extending LinkedHashMap") public void testRoundTripMap() { TypeNamesTester.INSTANCE.testRoundTripMap(createMapper(new TypeReference<LinkedHashMap<String, Animal>>() { }));//from www .j a v a 2 s .c om }
From source file:am.ik.sendgrid.SendGridClient.java
public Mono<List<Alert>> getAlerts() { return this.doGet("alerts", new TypeReference<List<Alert>>() { });/*from w ww .ja va2s.c o m*/ }
From source file:org.redisson.spring.cache.CacheConfigSupport.java
public Map<String, CacheConfig> fromJSON(URL url) throws IOException { return jsonMapper.readValue(url, new TypeReference<Map<String, CacheConfig>>() { });// w w w .j a va 2s . co m }
From source file:com.netflix.suro.sink.TestSinkManager.java
private Map<String, Sink> getSinkMap(ObjectMapper mapper, String desc) throws Exception { return mapper.<Map<String, Sink>>readValue(desc, new TypeReference<Map<String, Sink>>() { });// ww w . j av a2s.co m }
From source file:test.com.wealdtech.jackson.modules.TriValModuleTest.java
@Test public void testDeserStrPresent() throws Exception { final String ser = "\"test\""; final TriVal<String> deser = this.mapper.readValue(ser, new TypeReference<TriVal<String>>() { });//from w w w .j a v a 2s . co m assertTrue(deser.isPresent()); assertEquals(deser.get(), "test"); }
From source file:com.sojw.ahnchangho.core.util.UriUtils.java
/** * Multi value map.//from www . jav a2 s . c o m * * @param <T> the generic type * @param request the request * @return the string */ public static <T> MultiValueMap<String, String> multiValueMap(final T request) { if (request == null) { return null; } Map<String, Object> requestMap = JsonUtils.convertValue(request, new TypeReference<Map<String, Object>>() { }); if (MapUtils.isEmpty(requestMap)) { return null; } MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>(); for (Entry<String, Object> entry : requestMap.entrySet()) { if (entry.getValue() instanceof List) { ((List) entry.getValue()).forEach(each -> { parameters.add(entry.getKey(), each.toString()); }); } else { parameters.add(entry.getKey(), entry.getValue().toString()); } } return parameters; }