use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project candlepin by candlepin.
the class SyncUtils method getObjectMapper.
public ObjectMapper getObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(mapper.getTypeFactory());
AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary);
mapper.setAnnotationIntrospector(pair);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
// Filter specific things we do not want exported:
SimpleFilterProvider filterProvider = new SimpleFilterProvider();
filterProvider.setFailOnUnknownId(false);
filterProvider = filterProvider.addFilter("EntitlementFilter", SimpleBeanPropertyFilter.serializeAllExcept("consumer"));
mapper.setFilterProvider(filterProvider);
mapper.registerModule(productCachedModule);
if (config != null) {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, config.getBoolean(ConfigProperties.FAIL_ON_UNKNOWN_IMPORT_PROPERTIES));
}
return mapper;
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project drill by axbaretto.
the class DefaultSqlHandler method log.
protected void log(final String name, final PhysicalPlan plan, final Logger logger) throws JsonProcessingException {
if (logger.isDebugEnabled()) {
PropertyFilter filter = new SimpleBeanPropertyFilter.SerializeExceptFilter(Sets.newHashSet("password"));
String planText = plan.unparse(context.getLpPersistence().getMapper().writer(new SimpleFilterProvider().addFilter("passwordFilter", filter)));
logger.debug(name + " : \n" + planText);
}
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project drill by apache.
the class DefaultSqlHandler method log.
protected void log(final String name, final PhysicalPlan plan, final Logger logger) {
if (logger.isDebugEnabled()) {
PropertyFilter filter = new SimpleBeanPropertyFilter.SerializeExceptFilter(Sets.newHashSet("password"));
String planText = plan.unparse(context.getLpPersistence().getMapper().writer(new SimpleFilterProvider().addFilter("passwordFilter", filter)));
logger.debug(name + " : \n" + planText);
}
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project qpp-conversion-tool by CMSgov.
the class JsonWrapper method outfitMetadataFilter.
/**
* Outfit the given {@link ObjectMapper} with a filter that will treat all metadata map entries as transient.
*
* @param om object mapper to modify
*/
private static void outfitMetadataFilter(ObjectMapper om) {
SimpleFilterProvider filters = new SimpleFilterProvider();
filters.addFilter(METADATA_FILTER_LABEL, new MetadataPropertyFilter());
om.setAnnotationIntrospector(new JsonWrapperIntrospector(METADATA_FILTER_LABEL));
om.setFilterProvider(filters);
}
use of com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider in project eureka by Netflix.
the class AbstractEurekaJacksonCodec method bindAmazonInfoFilter.
private void bindAmazonInfoFilter(ObjectMapper mapper) {
SimpleFilterProvider filters = new SimpleFilterProvider();
final String filterName = "exclude-amazon-info-entries";
mapper.setAnnotationIntrospector(new JacksonAnnotationIntrospector() {
@Override
public Object findFilterId(Annotated a) {
if (Map.class.isAssignableFrom(a.getRawType())) {
return filterName;
}
return super.findFilterId(a);
}
});
filters.addFilter(filterName, new SimpleBeanPropertyFilter() {
@Override
protected boolean include(BeanPropertyWriter writer) {
return true;
}
@Override
protected boolean include(PropertyWriter writer) {
return MINI_AMAZON_INFO_INCLUDE_KEYS.contains(writer.getName());
}
});
mapper.setFilters(filters);
}
Aggregations