Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectReader.readValue()


        final ObjectWriter ssWriter = mapper.writer(filters);
        final ObjectReader ssReader = mapper.reader(sus.getClass());
       
        final String susString = ssWriter.writeValueAsString(sus);
        System.out.println(susString);
        final StorelessUnivariateStatistic newSus = ssReader.readValue(susString);
       
        assertEquals(expected, newSus.getResult(), 0.1);
    }
   
    @JsonFilter("storedDataFilter")
View Full Code Here


    @Override
    public final Object fromNonNullValue(String s) {
        try {
            final JsonWrapper jsonWrapper = objectReader.readValue(s);
            final ObjectReader typeReader = typedObjectReaders.getUnchecked(jsonWrapper.getType());
            return typeReader.readValue(jsonWrapper.getValue());
        }
        catch (JsonProcessingException e) {
            throw new IllegalArgumentException("Could not read from JSON: " + s, e);
        }
        catch (IOException e) {
View Full Code Here

        String xml = w.writeValueAsString(input);

//System.err.println("DEBUG: Xml == "+xml);

        ObjectReader r = MAPPER.reader(MediaItem.class);
        MediaItem result = r.readValue(xml);
        assertNotNull(result);
        assertEquals(content.getTitle(), result.getContent().getTitle());
    }
}
View Full Code Here

        XmlMapper xmlMapper = new XmlMapper();

        ObjectReader detecting = mapper.reader(POJO.class);
        detecting = detecting
                .withFormatDetection(detecting, xmlMapper.reader(POJO.class));
        POJO pojo = detecting.readValue(utf8Bytes("<POJO><y>3</y><x>1</x></POJO>"));
        assertNotNull(pojo);
        assertEquals(1, pojo.x);
        assertEquals(3, pojo.y);
    }
   
View Full Code Here

      ObjectReader reader = mapper.reader(classOfT);
      if (inject != null){
        reader = reader.with(inject);
      }
      try {
        return reader.readValue(objString);
    } catch (JsonParseException e) {
      throw new WebDriverException(e);
    } catch (JsonMappingException e) {
      throw new WebDriverException(e);
    } catch (IOException e) {
View Full Code Here

      ObjectReader reader = mapper.reader(TypeFactory.defaultInstance().constructCollectionType(List.class, classOfT));
      if (inject != null){
        reader = reader.with(inject);
      }
      try {
        return reader.readValue(objString);
    } catch (JsonParseException e) {
      throw new WebDriverException(e);
    } catch (JsonMappingException e) {
      throw new WebDriverException(e);
    } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.