Package com.fasterxml.jackson.databind.ser

Examples of com.fasterxml.jackson.databind.ser.FilterProvider


    @Test
    public final void givenTypeHasFilterThatIgnoresFieldByName_whenDtoIsSerialized_thenCorrect() throws JsonParseException, IOException {
        final ObjectMapper mapper = new ObjectMapper();
        final SimpleBeanPropertyFilter theFilter = SimpleBeanPropertyFilter.serializeAllExcept("intValue");
        final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter);

        final MyDtoWithFilter dtoObject = new MyDtoWithFilter();
        dtoObject.setIntValue(12);

        final String dtoAsString = mapper.writer(filters).writeValueAsString(dtoObject);
View Full Code Here


            @Override
            protected final boolean include(final PropertyWriter writer) {
                return true;
            }
        };
        final FilterProvider filters = new SimpleFilterProvider().addFilter("myFilter", theFilter);

        final MyDtoWithFilter dtoObject = new MyDtoWithFilter();
        dtoObject.setIntValue(-1);

        final ObjectMapper mapper = new ObjectMapper();
View Full Code Here

    public void testIssue44() throws IOException
    {
        String exp = "<Issue44Bean first=\"abc\"><second>13</second></Issue44Bean>";
        Issue44Bean bean = new Issue44Bean();

        FilterProvider prov = new SimpleFilterProvider().addFilter("filter44",
                SimpleBeanPropertyFilter.serializeAllExcept("filterMe"));
        ObjectWriter writer = _xmlMapper.writer(prov);

        // as well as with proper filter
        assertEquals(exp, writer.writeValueAsString(bean));
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.databind.ser.FilterProvider

Copyright © 2018 www.massapicom. 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.