Examples of writerWithView()


Examples of com.fasterxml.jackson.dataformat.xml.XmlMapper.writerWithView()

        xmlMapper.configure(MapperFeature.AUTO_DETECT_FIELDS, false );
        xmlMapper.configure(MapperFeature.AUTO_DETECT_GETTERS, false );
        xmlMapper.configure(MapperFeature.AUTO_DETECT_IS_GETTERS, false );
        xmlMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false );

        String xml = xmlMapper.writerWithView(RestrictedView.class).writeValueAsString(foo);
       
        // views not used for deserialization
        Foo result = xmlMapper.readValue(xml, Foo.class);
        assertEquals("test", result.restrictedFooProperty);
        assertNotNull(result.bars);
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithView()

    private ObjectWriter getWriter() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationConfig.Feature.DEFAULT_VIEW_INCLUSION, false);

        return mapper.writerWithView(AllViews.FormInfo.class);
    }

    @RequestMapping("{appId}/objects")
    public @ResponseBody String getBaseObjects(@PathVariable("appId") Integer appId) throws IOException {
        Map<String, Object> map = new HashMap<>();
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithView()

    public static <T> ObjectWriter getObjectWriter(@Nonnull Class<T> targetClass) {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationConfig.Feature.DEFAULT_VIEW_INCLUSION, false);

        return mapper.writerWithView(targetClass);
    }

    public static String writeSuccessObjectWithView(@Nonnull Object object, @Nonnull Class view) {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationConfig.Feature.DEFAULT_VIEW_INCLUSION, false);
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithView()

    public static String writeSuccessObjectWithView(@Nonnull Object object, @Nonnull Class view) {
        ObjectMapper mapper = new ObjectMapper();
        mapper.configure(SerializationConfig.Feature.DEFAULT_VIEW_INCLUSION, false);

        ObjectWriter writer = mapper.writerWithView(view);

        try {
            return writer.writeValueAsString(RestResponse.success(object));
        } catch (IOException e) {
            throw new RuntimeException("Unable to write JSON Object.", 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.