blob: 75766150dbddff88c21521b659555821fc37b52e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package com.fasterxml.jackson.databind.util;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
import java.util.Collection;
import java.util.Set;
public class IgnorePropertiesUtil
{
/**
* Decide if we need to ignore a property or not, given a set of field to ignore and a set of field to include.
*
* @since 2.12
*/
public static boolean shouldIgnore(Object value, Collection<String> toIgnore, Collection<String> toInclude) {
if (toIgnore == null && toInclude ==null) {
return false;
}
if (toInclude == null) {
return toIgnore.contains(value);
}
if (toIgnore == null) {
return !toInclude.contains(value);
}
// NOTE: conflict between both, JsonIncludeProperties will take priority.
return !toInclude.contains(value) || toIgnore.contains(value);
}
}
|