Java Code Examples for com.fasterxml.jackson.databind.ObjectMapper#setFilters()
The following examples show how to use
com.fasterxml.jackson.databind.ObjectMapper#setFilters() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InternalConfigStateController.java From springboot-shiro-cas-mybatis with MIT License | 6 votes |
@Override protected ObjectMapper initializeObjectMapper() { final ObjectMapper mapper = super.initializeObjectMapper(); final FilterProvider filters = new SimpleFilterProvider() .addFilter("beanObjectFilter", new CasSimpleBeanObjectFilter()); mapper.setFilters(filters); mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false); mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.addMixIn(Object.class, CasSimpleBeanObjectFilter.class); mapper.disable(SerializationFeature.INDENT_OUTPUT); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); return mapper; }
Example 2
Source File: TemplateEngine.java From bonita-ui-designer with GNU General Public License v2.0 | 5 votes |
public TemplateEngine(String template) { SimpleFilterProvider simpleFilterProvider = new SimpleFilterProvider(); simpleFilterProvider.setFailOnUnknownId(false); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setFilters(simpleFilterProvider); handlebars = new Handlebars(new ClassPathTemplateLoader("/", "")); handlebars.registerHelper("json", new Jackson2Helper(objectMapper)); handlebars.registerHelper("join", StringHelpers.join); handlebars.registerHelper("ifequal", IfEqualHelper.INSTANCE); handlebars.prettyPrint(true); location = "templates/" + template; }
Example 3
Source File: EagleServiceBaseClient.java From eagle with Apache License 2.0 | 4 votes |
protected static String marshall(List<?> entities) throws JsonMappingException, JsonGenerationException, IOException { final JsonFactory factory = new JsonFactory(); final ObjectMapper mapper = new ObjectMapper(factory); mapper.setFilters(TaggedLogAPIEntity.getFilterProvider()); return mapper.writeValueAsString(entities); }
Example 4
Source File: TaggedLogAPIEntity.java From eagle with Apache License 2.0 | 4 votes |
public static ObjectMapper buildObjectMapper() { final JsonFactory factory = new JsonFactory(); final ObjectMapper mapper = new ObjectMapper(factory); mapper.setFilters(TaggedLogAPIEntity.getFilterProvider()); return mapper; }
Example 5
Source File: TestTaggedLogAPIEntity.java From eagle with Apache License 2.0 | 4 votes |
@BeforeClass public static void setUp() { objectMapper = new ObjectMapper(); objectMapper.setFilters(TaggedLogAPIEntity.getFilterProvider()); objectMapper.registerModule(new EntityJsonModule()); }