Closed jml6m closed 10 years ago
Looks like using the FilterExceptFilter class makes the code work:
FilterProvider filters = new SimpleFilterProvider().addFilter("test", FilterExceptFilter.filterOutAllExcept("name"));
Still wondering why this works but the first line doesn't, considering they both return SimpleBeanPropertyFilter
This is related to refactoring done for 2.3, to allow use of filters for non-POJOs (Maps, mostly). Since Java will use nominal (compile-time) type for method binding in case of overloads it is either IDE problem or incorrect signature of filterOutAllExcept()
method.
I'll check if latter is the case. But if it is, I'll have to see if it can be fixed: unfortunately such change is not binary compatible.
Or perhaps type of
Ok, I think the problem originated from me using the 'org.codehaus.jackson' version of the class. It's compiling now that I used the updated package.
I'm having issues with this method in Jackson 2.3. Here is my piece of code, taken directly from the Wiki docs:
But for some reason, Eclipse (Kepler version) keeps displaying this error: The method addFilter(String, BeanPropertyFilter) in the type SimpleFilterProvider is not applicable for the arguments (String, SimpleBeanPropertyFilter)
It keeps reverting back to the deprecated method even though I'm passing a SimpleBeanPropertyFilter as an argument. I've even looked in SimpleFilterProvider.class and I've found the method I'm trying to use:
Is this a problem with my IDE, or with the library itself?