31
31
* <li>{@link URL}</li>
32
32
* <li>{@link File}</li>
33
33
* </ul>
34
- *
34
+ *
35
35
*/
36
36
@ SuppressWarnings ("resource" )
37
37
public class JSON implements Versioned
@@ -167,7 +167,7 @@ public enum Feature
167
167
* @since 2.7
168
168
*/
169
169
WRITE_DATES_AS_TIMESTAMP (false ),
170
-
170
+
171
171
/**
172
172
* Feature that can be enabled to use "pretty-printing", basic indentation
173
173
* to make resulting JSON easier to read by humans by adding white space
@@ -241,7 +241,7 @@ public enum Feature
241
241
* so that all Bean properties are serialized.
242
242
*/
243
243
WRITE_READONLY_BEAN_PROPERTIES (true , true ),
244
-
244
+
245
245
/**
246
246
* Feature that determines whether access to {@link java.lang.reflect.Method}s and
247
247
* {@link java.lang.reflect.Constructor}s that are used with dynamically
@@ -260,7 +260,7 @@ public enum Feature
260
260
* @since 2.5
261
261
*/
262
262
USE_IS_GETTERS (true , true ),
263
-
263
+
264
264
/**
265
265
* Feature that enables use of public fields instead of setters and getters,
266
266
* in cases where no setter/getter is available.
@@ -271,6 +271,16 @@ public enum Feature
271
271
* @since 2.8 (enabled by default since 2.10)
272
272
*/
273
273
USE_FIELDS (true , true ),
274
+
275
+ /**
276
+ * Feature that enables serialization and deserialization of non-final static fields.
277
+ *<p>
278
+ * Feature did not exist, but was implicitly <b>enabled</b> by default. <b>disabled</b> for
279
+ * 2.13).
280
+ *
281
+ * @since 2.13
282
+ */
283
+ INCLUDE_STATIC_FIELDS (false , true ),
274
284
;
275
285
276
286
/*
@@ -422,7 +432,7 @@ public static class Builder {
422
432
protected PrettyPrinter _prettyPrinter ;
423
433
424
434
// Configuration, helper objects
425
-
435
+
426
436
protected final JsonFactory _streamFactory ;
427
437
protected TreeCodec _treeCodec ;
428
438
@@ -502,7 +512,7 @@ public Builder disable(Feature ... features)
502
512
}
503
513
504
514
// // // Mutators, helper objects
505
-
515
+
506
516
/**
507
517
* Method for specifying {@link PrettyPrinter} {@link JSON} to be built
508
518
* should use on serialization.
@@ -732,7 +742,7 @@ protected JSONWriter _defaultWriter() {
732
742
public ObjectCodec asCodec () {
733
743
return new JSONAsObjectCodec (this );
734
744
}
735
-
745
+
736
746
/*
737
747
/**********************************************************************
738
748
/* Versioned
@@ -785,7 +795,7 @@ public JSON with(Feature feature, boolean state)
785
795
}
786
796
return _with (f );
787
797
}
788
-
798
+
789
799
/**
790
800
* Mutant factory for constructing an instance with specified features
791
801
* enabled.
@@ -825,7 +835,7 @@ protected final JSON _with(int features)
825
835
// changes
826
836
JSONReader r = _reader .withCacheCheck (features );
827
837
JSONWriter w = _writer .withCacheCheck (features );
828
-
838
+
829
839
return _with (features , _jsonFactory , _treeCodec ,
830
840
r , w , _prettyPrinter );
831
841
}
@@ -839,14 +849,14 @@ protected final JSON _with(int features)
839
849
/**
840
850
* Mutant factory method for constructing new instance with specified {@link JsonFactory}
841
851
* if different from currently configured one (if not, return {@code this} as-is)
842
- *
852
+ *
843
853
* @param f Jackson core format factory to use for low-level decoding/encoding
844
854
*
845
855
* @return New instance with specified factory (if not same as currently configured);
846
856
* {@code this} otherwise.
847
857
*
848
858
* @deprecated Since 2.11 should not try changing underlying stream factory but create
849
- * a new instance if necessary: method will be removed from 3.0 at latest
859
+ * a new instance if necessary: method will be removed from 3.0 at latest
850
860
*/
851
861
@ Deprecated
852
862
public JSON with (JsonFactory f ) {
@@ -966,7 +976,7 @@ public JSON with(ReaderWriterProvider rwp) {
966
976
/* Methods sub-classes must override
967
977
/**********************************************************************
968
978
*/
969
-
979
+
970
980
protected JSON _with (int features ,
971
981
JsonFactory jsonF , TreeCodec trees ,
972
982
JSONReader reader , JSONWriter writer ,
@@ -992,7 +1002,7 @@ public JsonFactory getStreamingFactory() {
992
1002
public final boolean isEnabled (Feature f ) {
993
1003
return (f .mask () & _features ) != 0 ;
994
1004
}
995
-
1005
+
996
1006
/*
997
1007
/**********************************************************************
998
1008
/* Public factory methods for parsers, generators
@@ -1122,7 +1132,7 @@ public CollectionComposer<?,List<Object>> composeList() {
1122
1132
public <C extends Collection <Object >> CollectionComposer <?,C > composeCollection (C collection ) {
1123
1133
return new CollectionComposer <ComposerBase ,C >(collection );
1124
1134
}
1125
-
1135
+
1126
1136
public MapComposer <?> composeMap () {
1127
1137
return composeMap (new LinkedHashMap <String ,Object >());
1128
1138
}
@@ -1294,7 +1304,7 @@ public <T> T beanFrom(Class<T> type, Object source) throws IOException, JSONObje
1294
1304
return _closeWithError (p , e );
1295
1305
}
1296
1306
}
1297
-
1307
+
1298
1308
/**
1299
1309
* Read method that will take given JSON Source (of one of supported types),
1300
1310
* read contents and map it to one of simple mappings ({@link java.util.Map}
@@ -1476,7 +1486,7 @@ public <T extends TreeNode> T createArrayNode() {
1476
1486
}
1477
1487
return (T ) _treeCodec .createArrayNode ();
1478
1488
}
1479
-
1489
+
1480
1490
/**
1481
1491
* Convenience method, equivalent to:
1482
1492
*<pre>
@@ -1527,7 +1537,7 @@ protected JSONWriter _writerForOperation(JsonGenerator gen) {
1527
1537
/* Internal methods, reading
1528
1538
/**********************************************************************
1529
1539
*/
1530
-
1540
+
1531
1541
protected JSONReader _readerForOperation (JsonParser p ) {
1532
1542
return _reader .perOperationInstance (_features , _valueReaderLocator , _treeCodec , p );
1533
1543
}
@@ -1585,7 +1595,7 @@ protected JsonParser _initForReading(JsonParser p) throws IOException
1585
1595
/* Internal methods, other
1586
1596
/**********************************************************************
1587
1597
*/
1588
-
1598
+
1589
1599
protected JsonGenerator _config (JsonGenerator g )
1590
1600
{
1591
1601
// First, possible pretty printing
@@ -1629,7 +1639,7 @@ protected <T> T _throw(Exception e) throws IOException {
1629
1639
}
1630
1640
throw new IOException (e ); // should never occur
1631
1641
}
1632
-
1642
+
1633
1643
protected void _noTreeCodec (String msg ) {
1634
1644
throw new IllegalStateException ("JSON instance does not have configured `TreeCodec` to " +msg );
1635
1645
}
@@ -1641,7 +1651,7 @@ protected void _noTreeCodec(String msg) {
1641
1651
*/
1642
1652
1643
1653
/**
1644
- * Extension context implementation used when
1654
+ * Extension context implementation used when
1645
1655
*/
1646
1656
private static class ExtContextImpl extends ExtensionContext {
1647
1657
final Builder _builder ;
0 commit comments