Skip to content

Commit 090c3ec

Browse files
authored
More injectable stuff (#5388)
1 parent 55ef6a9 commit 090c3ec

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyBasedCreator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ public SettableBeanProperty findCreatorProperty(int propertyIndex) {
258258
*/
259259
public PropertyValueBuffer startBuilding(JsonParser p, DeserializationContext ctxt,
260260
ObjectIdReader oir) {
261-
return new PropertyValueBuffer(p, ctxt, _propertyCount, oir, null);
261+
return new PropertyValueBuffer(p, ctxt, _propertyCount, oir, null,
262+
_injectablePropIndexes);
262263
}
263264

264265
/**
@@ -269,7 +270,8 @@ public PropertyValueBuffer startBuilding(JsonParser p, DeserializationContext ct
269270
public PropertyValueBuffer startBuildingWithAnySetter(JsonParser p, DeserializationContext ctxt,
270271
ObjectIdReader oir, SettableAnyProperty anySetter
271272
) {
272-
return new PropertyValueBuffer(p, ctxt, _propertyCount, oir, anySetter);
273+
return new PropertyValueBuffer(p, ctxt, _propertyCount, oir, anySetter,
274+
_injectablePropIndexes);
273275
}
274276

275277
public Object build(DeserializationContext ctxt, PropertyValueBuffer buffer) throws IOException

src/main/java/com/fasterxml/jackson/databind/deser/impl/PropertyValueBuffer.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class PropertyValueBuffer
6464
/**
6565
* If we get non-creator parameters before or between
6666
* creator parameters, those need to be buffered. Buffer
67-
* is just a simple linked list
67+
* is just a simple linked list.
6868
*/
6969
protected PropertyValue _buffered;
7070

@@ -75,7 +75,7 @@ public class PropertyValueBuffer
7575
protected Object _idValue;
7676

7777
/**
78-
* "Any setter" property bound to a Creator parameter (via {@code @JsonAnySetter})
78+
* "Any setter" property bound to a Creator parameter (via {@code @JsonAnySetter}).
7979
*
8080
* @since 2.18
8181
*/
@@ -89,17 +89,25 @@ public class PropertyValueBuffer
8989
*/
9090
protected PropertyValue _anyParamBuffered;
9191

92+
/**
93+
* Indexes properties that are injectable, if any; {@code null} if none.
94+
*
95+
* @since 2.21
96+
*/
97+
protected final BitSet _injectablePropIndexes;
98+
9299
/*
93100
/**********************************************************
94101
/* Life-cycle
95102
/**********************************************************
96103
*/
97104

98105
/**
99-
* @since 2.18
106+
* @since 2.21
100107
*/
101108
public PropertyValueBuffer(JsonParser p, DeserializationContext ctxt, int paramCount,
102-
ObjectIdReader oir, SettableAnyProperty anyParamSetter)
109+
ObjectIdReader oir, SettableAnyProperty anyParamSetter,
110+
BitSet injectablePropIndexes)
103111
{
104112
_parser = p;
105113
_context = ctxt;
@@ -117,9 +125,19 @@ public PropertyValueBuffer(JsonParser p, DeserializationContext ctxt, int paramC
117125
} else {
118126
_anyParamSetter = anyParamSetter;
119127
}
128+
_injectablePropIndexes = (injectablePropIndexes == null)
129+
? null : (BitSet) injectablePropIndexes.clone();
120130
}
121131

122-
/**
132+
// @since 2.18
133+
@Deprecated // since 2.21
134+
public PropertyValueBuffer(JsonParser p, DeserializationContext ctxt, int paramCount,
135+
ObjectIdReader oir, SettableAnyProperty anyParamSetter)
136+
{
137+
this(p, ctxt, paramCount, oir, anyParamSetter, null);
138+
}
139+
140+
/**
123141
* Returns {@code true} if the given property was seen in the JSON source by
124142
* this buffer.
125143
*

0 commit comments

Comments
 (0)