1

I have the following part of code that helps me mask certain attributes of a json response,

ObjectMapper mapper = new ObjectMapper(); mapper.setFilters(new SimpleFilterProvider().addFilter("sampleFilter", new SampleFilter()) .addFilter("simpleFilter",new SimpleFilter()));

But I realized that the setFilters() method is deprecated...I would like to replace this with an alternate method. Any help greatly appreciated!

1 Answers1

1

Normally, the JavaDocs will provide you with a new way of archieving the behaviour. In your case it says:

Deprecated. Since 2.6, use setFilterProvider(com.fasterxml.jackson.databind.ser.FilterProvider) instead (allows chaining)

Source.

So you just need to change the method name, as the arguments stay the same. It now returns the ObjectMapper object so you can chain method calls (as described in the Javadoc)

peterulb
  • 2,869
  • 13
  • 20