use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project photo-picker-plus-android by chute.
the class MediaModel method serializeImageDataModel.
public String serializeImageDataModel() {
FilterProvider filters = new SimpleFilterProvider().addFilter("imageDataModelFilter", SimpleBeanPropertyFilter.filterOutAllExcept("options", "media"));
String result = null;
try {
result = JsonUtil.getMapper().writer(filters).writeValueAsString(this);
} catch (JsonProcessingException e) {
Log.d(TAG, "", e);
}
return result;
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project jackson-databind by FasterXML.
the class TestAnyGetterFiltering method testAnyGetterFiltering.
/*
/**********************************************************
/* Test methods
/**********************************************************
*/
public void testAnyGetterFiltering() throws Exception {
ObjectMapper mapper = new ObjectMapper();
FilterProvider prov = new SimpleFilterProvider().addFilter("anyFilter", SimpleBeanPropertyFilter.filterOutAllExcept("b"));
assertEquals("{\"b\":\"2\"}", mapper.writer(prov).writeValueAsString(new AnyBean()));
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project jackson-databind by FasterXML.
the class TestMapFiltering method testMapFilteringWithAnnotations.
// [databind#522]
public void testMapFilteringWithAnnotations() throws Exception {
FilterProvider prov = new SimpleFilterProvider().addFilter("filterX", new TestMapFilter());
String json = MAPPER.writer(prov).writeValueAsString(new MapBean());
// a=1 should become a=2
assertEquals(aposToQuotes("{'values':{'a':2}}"), json);
// and then one without annotation as contrast
json = MAPPER.writer(prov).writeValueAsString(new MapBeanNoOffset());
assertEquals(aposToQuotes("{'values':{'a':1}}"), json);
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project jackson-databind by FasterXML.
the class TestMapFiltering method testMapFilteringViaProps.
public void testMapFilteringViaProps() throws Exception {
FilterProvider prov = new SimpleFilterProvider().addFilter("filterX", SimpleBeanPropertyFilter.filterOutAllExcept("b"));
String json = MAPPER.writer(prov).writeValueAsString(new MapBean());
assertEquals(aposToQuotes("{'values':{'b':5}}"), json);
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project jackson-databind by FasterXML.
the class TestMapFiltering method testMapFilteringViaClass.
public void testMapFilteringViaClass() throws Exception {
FilteredBean bean = new FilteredBean();
bean.put("a", 4);
bean.put("b", 3);
FilterProvider prov = new SimpleFilterProvider().addFilter("filterForMaps", SimpleBeanPropertyFilter.filterOutAllExcept("b"));
String json = MAPPER.writer(prov).writeValueAsString(bean);
assertEquals(aposToQuotes("{'b':3}"), json);
}
Aggregations