@Test public void test() throws Exception { IstexData metadata = target.fromJson("{\"corpusName\":\"bmj\",\"istexId\":\"052DFBD14E0015CA914E28A0A561675D36FFA2CC\",\"ark\":[\"ark:/67375/NVC-W015BZV5-Q\"],\"doi\":[\"10.1136/sti.53.1.56\"],\"pmid\":[\"557360\"],\"pii\":[\"123\"]}"); assertThat(metadata, is(not(nullValue()))); assertThat(metadata.getCorpusName(), is("bmj")); assertThat(metadata.getIstexId(), is("052DFBD14E0015CA914E28A0A561675D36FFA2CC")); assertThat(metadata.getDoi(), hasSize(1)); assertThat(metadata.getDoi().get(0), is("10.1136/sti.53.1.56")); assertThat(metadata.getArk(), hasSize(1)); assertThat(metadata.getArk().get(0), is("ark:/67375/NVC-W015BZV5-Q")); assertThat(metadata.getPmid(), hasSize(1)); assertThat(metadata.getPmid().get(0), is("557360")); assertThat(metadata.getPii(), hasSize(1)); assertThat(metadata.getPii().get(0), is("123")); }
public IstexData fromJson(String inputLine) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); return mapper.readValue(inputLine, IstexData.class); } catch (JsonGenerationException | JsonMappingException e) { LOGGER.error("The input line cannot be processed\n " + inputLine + "\n ", e); } catch (IOException e) { LOGGER.error("Some serious error when deserialize the JSON object: \n" + inputLine, e); } return null; }
IstexIdsReader { public IstexData fromJson(String inputLine) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); return mapper.readValue(inputLine, IstexData.class); } catch (JsonGenerationException | JsonMappingException e) { LOGGER.error("The input line cannot be processed\n " + inputLine + "\n ", e); } catch (IOException e) { LOGGER.error("Some serious error when deserialize the JSON object: \n" + inputLine, e); } return null; } }
IstexIdsReader { public IstexData fromJson(String inputLine) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); return mapper.readValue(inputLine, IstexData.class); } catch (JsonGenerationException | JsonMappingException e) { LOGGER.error("The input line cannot be processed\n " + inputLine + "\n ", e); } catch (IOException e) { LOGGER.error("Some serious error when deserialize the JSON object: \n" + inputLine, e); } return null; }  }
IstexIdsReader { public IstexData fromJson(String inputLine) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); return mapper.readValue(inputLine, IstexData.class); } catch (JsonGenerationException | JsonMappingException e) { LOGGER.error("The input line cannot be processed\n " + inputLine + "\n ", e); } catch (IOException e) { LOGGER.error("Some serious error when deserialize the JSON object: \n" + inputLine, e); } return null; }  void load(String input, Consumer<IstexData> closure); void load(InputStream input, Consumer<IstexData> closure); IstexData fromJson(String inputLine); }
IstexIdsReader { public IstexData fromJson(String inputLine) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); return mapper.readValue(inputLine, IstexData.class); } catch (JsonGenerationException | JsonMappingException e) { LOGGER.error("The input line cannot be processed\n " + inputLine + "\n ", e); } catch (IOException e) { LOGGER.error("Some serious error when deserialize the JSON object: \n" + inputLine, e); } return null; }  void load(String input, Consumer<IstexData> closure); void load(InputStream input, Consumer<IstexData> closure); IstexData fromJson(String inputLine);  }