aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java')
-rw-r--r--src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java
index 261175047..6126029a0 100644
--- a/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java
+++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java
@@ -88,8 +88,19 @@ public class MapDeserializer
// // Any properties to ignore if seen?
protected Set<String> _ignorableProperties;
+
+ /**
+ * @since 2.12
+ */
protected Set<String> _includableProperties;
+ /**
+ * Helper object used for name-based filtering
+ *
+ * @since 2.12
+ */
+ protected IgnorePropertiesUtil.Checker _inclusionChecker;
+
/*
/**********************************************************
/* Life-cycle
@@ -109,6 +120,7 @@ public class MapDeserializer
_delegateDeserializer = null;
_propertyBasedCreator = null;
_standardStringKey = _isStdKeyDeser(mapType, keyDeser);
+ _inclusionChecker = null;
}
/**
@@ -128,6 +140,7 @@ public class MapDeserializer
// should we make a copy here?
_ignorableProperties = src._ignorableProperties;
_includableProperties = src._includableProperties;
+ _inclusionChecker = src._inclusionChecker;
_standardStringKey = src._standardStringKey;
}
@@ -145,11 +158,11 @@ public class MapDeserializer
* @since 2.12
*/
protected MapDeserializer(MapDeserializer src,
- KeyDeserializer keyDeser, JsonDeserializer<Object> valueDeser,
- TypeDeserializer valueTypeDeser,
- NullValueProvider nuller,
- Set<String> ignorable,
- Set<String> includable)
+ KeyDeserializer keyDeser, JsonDeserializer<Object> valueDeser,
+ TypeDeserializer valueTypeDeser,
+ NullValueProvider nuller,
+ Set<String> ignorable,
+ Set<String> includable)
{
super(src, nuller, src._unwrapSingle);
_keyDeserializer = keyDeser;
@@ -161,6 +174,7 @@ public class MapDeserializer
_hasDefaultCreator = src._hasDefaultCreator;
_ignorableProperties = ignorable;
_includableProperties = includable;
+ _inclusionChecker = IgnorePropertiesUtil.buildCheckerIfNeeded(ignorable, includable);
_standardStringKey = _isStdKeyDeser(_containerType, keyDeser);
}
@@ -221,15 +235,18 @@ public class MapDeserializer
public void setIgnorableProperties(String[] ignorable) {
_ignorableProperties = (ignorable == null || ignorable.length == 0) ?
null : ArrayBuilders.arrayToSet(ignorable);
+ _inclusionChecker = IgnorePropertiesUtil.buildCheckerIfNeeded(_ignorableProperties, _includableProperties);
}
public void setIgnorableProperties(Set<String> ignorable) {
_ignorableProperties = (ignorable == null || ignorable.size() == 0) ?
null : ignorable;
+ _inclusionChecker = IgnorePropertiesUtil.buildCheckerIfNeeded(_ignorableProperties, _includableProperties);
}
public void setIncludableProperties(Set<String> includable) {
_includableProperties = includable;
+ _inclusionChecker = IgnorePropertiesUtil.buildCheckerIfNeeded(_ignorableProperties, _includableProperties);
}
/*
@@ -514,7 +531,7 @@ public class MapDeserializer
Object key = keyDes.deserializeKey(keyStr, ctxt);
// And then the value...
JsonToken t = p.nextToken();
- if (IgnorePropertiesUtil.shouldIgnore(keyStr, _ignorableProperties, _includableProperties)) {
+ if ((_inclusionChecker != null) && _inclusionChecker.shouldIgnore(keyStr)) {
p.skipChildren();
continue;
}
@@ -576,7 +593,7 @@ public class MapDeserializer
for (; key != null; key = p.nextFieldName()) {
JsonToken t = p.nextToken();
- if (IgnorePropertiesUtil.shouldIgnore(key, _ignorableProperties, _includableProperties)) {
+ if ((_inclusionChecker != null) && _inclusionChecker.shouldIgnore(key)) {
p.skipChildren();
continue;
}
@@ -628,7 +645,7 @@ public class MapDeserializer
for (; key != null; key = p.nextFieldName()) {
JsonToken t = p.nextToken(); // to get to value
- if (IgnorePropertiesUtil.shouldIgnore(key, _ignorableProperties, _includableProperties)) {
+ if ((_inclusionChecker != null) && _inclusionChecker.shouldIgnore(key)) {
p.skipChildren(); // and skip it (in case of array/object)
continue;
}
@@ -717,7 +734,7 @@ public class MapDeserializer
Object key = keyDes.deserializeKey(keyStr, ctxt);
// And then the value...
JsonToken t = p.nextToken();
- if (IgnorePropertiesUtil.shouldIgnore(keyStr, _ignorableProperties, _includableProperties)) {
+ if ((_inclusionChecker != null) && _inclusionChecker.shouldIgnore(keyStr)) {
p.skipChildren();
continue;
}
@@ -784,7 +801,7 @@ public class MapDeserializer
for (; key != null; key = p.nextFieldName()) {
JsonToken t = p.nextToken();
- if (IgnorePropertiesUtil.shouldIgnore(key, _ignorableProperties, _includableProperties)) {
+ if ((_inclusionChecker != null) && _inclusionChecker.shouldIgnore(key)) {
p.skipChildren();
continue;
}