本文整理汇总了Java中com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter.FilterExceptFilter方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleBeanPropertyFilter.FilterExceptFilter方法的具体用法?Java SimpleBeanPropertyFilter.FilterExceptFilter怎么用?Java SimpleBeanPropertyFilter.FilterExceptFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter
的用法示例。
在下文中一共展示了SimpleBeanPropertyFilter.FilterExceptFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBody
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; //导入方法依赖的package包/类
@Override
public String getBody() throws Exception {
Set<String> properties = new HashSet<String>();
for (String field : fields) {
properties.add(field);
}
SimpleBeanPropertyFilter filter = new SimpleBeanPropertyFilter.FilterExceptFilter(properties);
SimpleFilterProvider provider = new SimpleFilterProvider();
provider.addFilter("update inventory request filter", filter);
return mapper.writer(provider).writeValueAsString(inventory);
}
示例2: modify
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; //导入方法依赖的package包/类
@Override
public ObjectWriter modify(EndpointConfigBase<?> endpoint, MultivaluedMap<String, Object> responseHeaders, Object valueToWrite,
ObjectWriter w, JsonGenerator g) throws IOException {
SimpleBeanPropertyFilter filter = null;
if (includes != null && !includes.isEmpty()) {
filter = new SimpleBeanPropertyFilter.FilterExceptFilter(includes);
} else if (excludes != null && !excludes.isEmpty()) {
filter = SimpleBeanPropertyFilter.serializeAllExcept(excludes);
} else {
filter = SimpleBeanPropertyFilter.serializeAllExcept(new HashSet<String>());
}
FilterProvider provider = new SimpleFilterProvider().addFilter("property_filter", filter);
return w.with(provider);
}