use of com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector 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.introspect.JacksonAnnotationIntrospector in project build-info by JFrogDev.
the class ArtifactoryHttpClient method createJsonFactory.
public JsonFactory createJsonFactory() {
JsonFactory jsonFactory = new JsonFactory();
ObjectMapper mapper = new ObjectMapper(jsonFactory);
mapper.setAnnotationIntrospector(new JacksonAnnotationIntrospector());
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
jsonFactory.setCodec(mapper);
return jsonFactory;
}
use of com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector 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);
}
use of com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector in project oxAuth by GluuFederation.
the class Util method createJsonMapper.
public static ObjectMapper createJsonMapper() {
final AnnotationIntrospector jaxb = new JaxbAnnotationIntrospector();
final AnnotationIntrospector jackson = new JacksonAnnotationIntrospector();
final AnnotationIntrospector pair = AnnotationIntrospector.pair(jackson, jaxb);
final ObjectMapper mapper = new ObjectMapper();
mapper.getDeserializationConfig().with(pair);
mapper.getSerializationConfig().with(pair);
return mapper;
}
use of com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector in project spring-framework by spring-projects.
the class Jackson2ObjectMapperBuilderTests method postConfigurer.
// gh-23017
@Test
void postConfigurer() {
JacksonAnnotationIntrospector introspector1 = new JacksonAnnotationIntrospector();
JacksonAnnotationIntrospector introspector2 = new JacksonAnnotationIntrospector();
ObjectMapper mapper = Jackson2ObjectMapperBuilder.json().postConfigurer(m -> m.setAnnotationIntrospectors(introspector1, introspector2)).build();
assertThat(mapper.getSerializationConfig().getAnnotationIntrospector()).isSameAs(introspector1);
assertThat(mapper.getDeserializationConfig().getAnnotationIntrospector()).isSameAs(introspector2);
}
Aggregations