List of usage examples for com.fasterxml.jackson.core.type TypeReference TypeReference
protected TypeReference()
From source file:com.github.nmorel.gwtjackson.jackson.options.WriteNullMapValuesOptionJacksonTest.java
@Test public void testWriteNullValues() { WriteNullMapValuesOptionTester.INSTANCE .testWriteNullValues(createWriter(new TypeReference<Map<String, String>>() { }));/*w w w . ja v a 2 s.co m*/ }
From source file:com.htmlhifive.pitalium.core.selenium.PtlWebDriverFactoryTest.java
@Test public void testGetInstance_InternetExplorer() throws Exception { TypeReference<List<Map<String, Object>>> reference = new TypeReference<List<Map<String, Object>>>() { };/* w w w . j a v a2 s . com*/ List<Map<String, Object>> maps = JSONUtils .readValue(getClass().getResourceAsStream("FactoryTest_capabilities.json"), reference); List<PtlCapabilities> caps = Lists.transform(maps, new Function<Map<String, Object>, PtlCapabilities>() { @Override public PtlCapabilities apply(Map<String, Object> input) { return new PtlCapabilities(input); } }); assertThat(getFactoryName(caps.get(0)), is(containsString("internetexplorer"))); assertThat(getFactoryName(caps.get(1)), is(containsString("internetexplorer"))); assertThat(getFactoryName(caps.get(2)), is(containsString("internetexplorer"))); assertThat(getFactoryName(caps.get(3)), is(containsString("internetexplorer8"))); assertThat(getFactoryName(caps.get(4)), is(containsString("internetexplorer7"))); assertThat(getFactoryName(caps.get(5)), is(containsString("chrome"))); assertThat(getFactoryName(caps.get(6)), is(containsString("firefox"))); assertThat(getFactoryName(caps.get(7)), is(containsString("safari"))); assertThat(getFactoryName(caps.get(8)), is(containsString("chrome"))); assertThat(getFactoryName(caps.get(9)), is(containsString("android"))); assertThat(getFactoryName(caps.get(10)), is(containsString("selendroid"))); assertThat(getFactoryName(caps.get(11)), is(containsString("ipad"))); assertThat(getFactoryName(caps.get(12)), is(containsString("iphone"))); assertThat(getFactoryName(caps.get(13)), is(containsString("edge"))); }
From source file:net.sarangnamu.home.api.Api.java
public static ArrayList<Notice> notices(int page) throws Exception { initHttp();//from w ww .jav a 2 s . c o m http.setMethod("GET"); Map<String, String> params = new HashMap<String, String>(); params.put("nPage", "" + page); String res = http.submit(URI_NOTICE, params); return (ArrayList<Notice>) JsonTool.toObj(res, new TypeReference<List<Notice>>() { }); }
From source file:com.kinvey.business_logic.KinveyAppMetadataTest.java
@Before public void setUp() throws Exception { File file = FileUtils.getFile("src", "test", "resources", "Request_CollectionArguments.json"); ObjectMapper mapper = new ObjectMapper(); request = mapper.readValue(file, new TypeReference<Request<CollectionArguments>>() { });//from w w w . j a v a 2 s. c o m }
From source file:org.apache.hadoop.gateway.util.JsonUtils.java
public static Map<String, String> getMapFromJsonString(String json) { Map<String, String> map = null; JsonFactory factory = new JsonFactory(); ObjectMapper mapper = new ObjectMapper(factory); TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() { };/* ww w .j ava2 s .c o m*/ try { map = mapper.readValue(json, typeRef); } catch (JsonParseException e) { LOG.failedToGetMapFromJsonString(json, e); } catch (JsonMappingException e) { LOG.failedToGetMapFromJsonString(json, e); } catch (IOException e) { LOG.failedToGetMapFromJsonString(json, e); } return map; }
From source file:com.netflix.edda.JsonHelper.java
public static <T> T decode(Class<T> c, Reader input) throws IOException { try {/*from w ww . j a va 2 s . c o m*/ TypeReference<T> ref = new TypeReference<T>() { }; return createParser(input).readValueAs(ref); } finally { input.close(); } }
From source file:com.github.nmorel.gwtjackson.jackson.options.OrderMapEntriesByKeysOptionJacksonTest.java
@Test public void testWriteUnordered() { OrderMapEntriesByKeysOptionTester.INSTANCE .testWriteUnordered(createWriter(new TypeReference<LinkedHashMap<String, Integer>>() { }));// w w w. ja va2 s .c o m }
From source file:org.redisson.client.codec.JsonJacksonMapValueCodec.java
public JsonJacksonMapValueCodec(Class<T> klass) { this(new TypeReference<T>() { }); }
From source file:com.skcraft.launcher.creator.util.NemModList.java
public void load(String version) throws IOException, InterruptedException { checkNotNull(version, "version"); List<ModEntry> mods = HttpRequest.get(HttpRequest.url("https://bot.notenoughmods.com/" + version + ".json")) .execute().expectResponseCode(200).returnContent().asJson(new TypeReference<List<ModEntry>>() { });/*from w w w .j a v a2 s . co m*/ Map<String, ModEntry> index = Maps.newHashMap(); for (ModEntry entry : mods) { index.put(entry.getModId(), entry); } this.mods = Collections.unmodifiableMap(index); }
From source file:com.anrisoftware.simplerest.owncloudocs.SharesParseJsonResponse.java
protected SharesParseJsonResponse() { super("ocs", new TypeReference<Map<String, DefaultSharesMessage>>() { }); }