Skip to content

Commit be5af88

Browse files
committed
Add 2 more text-format - specific StreamReadCapability entries
1 parent cf2c1a7 commit be5af88

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/main/java/com/fasterxml/jackson/core/StreamReadCapability.java

+20-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,30 @@ public enum StreamReadCapability
2424
* Capability may be used for allowing secondary mapping of such duplicates
2525
* in case of using Tree Model (see {@link TreeNode}), or "untyped" databinding
2626
* (mapping content as generic {@link java.lang.Object}).
27-
*
2827
*<p>
29-
* Capability is typically {@code false}, hence default.
28+
* Capability is currently only enabled for XML format backend.
3029
*/
3130
DUPLICATE_PROPERTIES(false),
3231

32+
/**
33+
* Capability that indicates that data format may in some cases expose Scalar values
34+
* (whether typed or untyped) as Object values. There are additional access methods
35+
* at databind level: this capability may be used to decide whether to attempt to
36+
* use such methods especially in potentially ambiguous cases.
37+
*<p>
38+
* Capability is currently only enabled for XML format backend.
39+
*/
40+
SCALARS_AS_OBJECTS(false),
41+
42+
/**
43+
* Capability that indicates that data format only exposed "untyped" scalars: that is,
44+
* instead of Number, Boolean and String types all scalar values are reported as
45+
* text ({@link JsonToken#VALUE_STRING})
46+
* unless some sort of coercion is implied by caller.
47+
*<p>
48+
* This capability is true for many textual formats like CSV, Properties and XML.
49+
*/
50+
UNTYPED_SCALARS(false),
3351
;
3452

3553
/**
@@ -50,5 +68,4 @@ private StreamReadCapability(boolean defaultState) {
5068
public boolean enabledIn(int flags) { return (flags & _mask) != 0; }
5169
@Override
5270
public int getMask() { return _mask; }
53-
5471
}

src/test/java/com/fasterxml/jackson/core/read/ParserFeaturesTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ private void _testDefaultSettings(JsonParser p) throws Exception {
6060

6161
// [core#619]:
6262
assertFalse(p.getReadCapabilities().isEnabled(StreamReadCapability.DUPLICATE_PROPERTIES));
63+
assertFalse(p.getReadCapabilities().isEnabled(StreamReadCapability.SCALARS_AS_OBJECTS));
64+
assertFalse(p.getReadCapabilities().isEnabled(StreamReadCapability.UNTYPED_SCALARS));
6365

6466
p.close();
6567
}

0 commit comments

Comments
 (0)