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);
assertEquals(2, result.bars.length);
assertEquals(10, result.bars[0].restrictedBarProperty);
assertEquals(11, result.bars[1].restrictedBarProperty);