67
67
// and find values by, for example, using a {@link com.fasterxml.jackson.core.JsonPointer} expression:
68
68
int age = root.at("/personal/age").getValueAsInt();
69
69
</pre>
70
- *<p>
71
- * The main conversion API is defined in {@link ObjectCodec}, so that
72
- * implementation details of this class need not be exposed to
73
- * streaming parser and generator classes. Usage via {@link ObjectCodec} is,
74
- * however, usually only for cases where dependency to {@link ObjectMapper} is
75
- * either not possible (from Streaming API), or undesireable (when only relying
76
- * on Streaming API).
77
70
*<p>
78
71
* Mapper instances are fully thread-safe provided that ALL configuration of the
79
72
* instance occurs before ANY read or write calls. If configuration of a mapper instance
116
109
* (using {@link #setDefaultTyping}).
117
110
*/
118
111
public class ObjectMapper
119
- extends ObjectCodec
120
112
implements Versioned ,
121
113
java .io .Serializable
122
114
{
@@ -490,7 +482,6 @@ public ObjectMapper(TokenStreamFactory jf) {
490
482
protected ObjectMapper (ObjectMapper src )
491
483
{
492
484
_jsonFactory = src ._jsonFactory .copy ();
493
- _jsonFactory .setCodec (this );
494
485
_subtypeResolver = src ._subtypeResolver ;
495
486
_typeFactory = src ._typeFactory ;
496
487
_injectableValues = src ._injectableValues ;
@@ -535,14 +526,9 @@ public ObjectMapper(TokenStreamFactory jf,
535
526
// 06-OCt-2017, tatu: Should probably change dependency one of these days...
536
527
// but not today.
537
528
if (jf == null ) {
538
- _jsonFactory = new JsonFactory ();
539
- _jsonFactory .setCodec (this );
540
- } else {
541
- _jsonFactory = jf ;
542
- if (jf .getCodec () == null ) { // as per [JACKSON-741]
543
- _jsonFactory .setCodec (this );
544
- }
529
+ jf = new JsonFactory ();
545
530
}
531
+ _jsonFactory = jf ;
546
532
_subtypeResolver = new StdSubtypeResolver ();
547
533
RootNameLookup rootNames = new RootNameLookup ();
548
534
// and default type factory is shared one
@@ -732,9 +718,9 @@ public Version getMapperVersion() {
732
718
733
719
@ SuppressWarnings ("unchecked" )
734
720
@ Override
735
- public < C extends ObjectCodec > C getOwner () {
721
+ public Object getOwner () {
736
722
// why do we need the cast here?!?
737
- return ( C ) ObjectMapper .this ;
723
+ return ObjectMapper .this ;
738
724
}
739
725
740
726
@ Override
@@ -1733,7 +1719,6 @@ public ObjectMapper setConfig(SerializationConfig config) {
1733
1719
* @return {@link TokenStreamFactory} that this mapper uses when it needs to
1734
1720
* construct Json parser and generators
1735
1721
*/
1736
- @ Override
1737
1722
public TokenStreamFactory getFactory () { return _jsonFactory ; }
1738
1723
1739
1724
/**
@@ -1753,9 +1738,6 @@ public ObjectMapper setDateFormat(DateFormat dateFormat)
1753
1738
return this ;
1754
1739
}
1755
1740
1756
- /**
1757
- * @since 2.5
1758
- */
1759
1741
public DateFormat getDateFormat () {
1760
1742
// arbitrary choice but let's do:
1761
1743
return _serializationConfig .getDateFormat ();
@@ -2152,7 +2134,6 @@ public boolean isEnabled(JsonFactory.Feature f) {
2152
2134
* @throws JsonMappingException if the input JSON structure does not match structure
2153
2135
* expected for result type (or has other mismatch issues)
2154
2136
*/
2155
- @ Override
2156
2137
@ SuppressWarnings ("unchecked" )
2157
2138
public <T > T readValue (JsonParser p , Class <T > valueType )
2158
2139
throws IOException , JsonParseException , JsonMappingException
@@ -2177,7 +2158,6 @@ public <T> T readValue(JsonParser p, Class<T> valueType)
2177
2158
* @throws JsonMappingException if the input JSON structure does not match structure
2178
2159
* expected for result type (or has other mismatch issues)
2179
2160
*/
2180
- @ Override
2181
2161
@ SuppressWarnings ("unchecked" )
2182
2162
public <T > T readValue (JsonParser p , TypeReference <?> valueTypeRef )
2183
2163
throws IOException , JsonParseException , JsonMappingException
@@ -2201,7 +2181,6 @@ public <T> T readValue(JsonParser p, TypeReference<?> valueTypeRef)
2201
2181
* @throws JsonMappingException if the input JSON structure does not match structure
2202
2182
* expected for result type (or has other mismatch issues)
2203
2183
*/
2204
- @ Override
2205
2184
@ SuppressWarnings ("unchecked" )
2206
2185
public final <T > T readValue (JsonParser p , ResolvedType valueType )
2207
2186
throws IOException , JsonParseException , JsonMappingException
@@ -2250,7 +2229,6 @@ public <T> T readValue(JsonParser p, JavaType valueType)
2250
2229
* @throws JsonParseException if underlying input contains invalid content
2251
2230
* of type {@link JsonParser} supports (JSON for default case)
2252
2231
*/
2253
- @ Override
2254
2232
public <T extends TreeNode > T readTree (JsonParser p )
2255
2233
throws IOException , JsonProcessingException
2256
2234
{
@@ -2296,21 +2274,6 @@ public <T extends TreeNode> T readTree(JsonParser p)
2296
2274
*<p>
2297
2275
* Note that {@link ObjectReader} has more complete set of variants.
2298
2276
*/
2299
- @ Override
2300
- public <T > MappingIterator <T > readValues (JsonParser p , ResolvedType valueType )
2301
- throws IOException , JsonProcessingException
2302
- {
2303
- return readValues (p , (JavaType ) valueType );
2304
- }
2305
-
2306
- /**
2307
- * Convenience method, equivalent in function to:
2308
- *<pre>
2309
- * readerFor(valueType).readValues(p);
2310
- *</pre>
2311
- *<p>
2312
- * Type-safe overload of {@link #readValues(JsonParser, ResolvedType)}.
2313
- */
2314
2277
public <T > MappingIterator <T > readValues (JsonParser p , JavaType valueType )
2315
2278
throws IOException , JsonProcessingException
2316
2279
{
@@ -2327,25 +2290,14 @@ public <T> MappingIterator<T> readValues(JsonParser p, JavaType valueType)
2327
2290
* readerFor(valueType).readValues(p);
2328
2291
*</pre>
2329
2292
*<p>
2330
- * Type-safe overload of {@link #readValues(JsonParser, ResolvedType )}.
2293
+ * Type-safe overload of {@link #readValues(JsonParser, JavaType )}.
2331
2294
*/
2332
- @ Override
2333
2295
public <T > MappingIterator <T > readValues (JsonParser p , Class <T > valueType )
2334
2296
throws IOException , JsonProcessingException
2335
2297
{
2336
2298
return readValues (p , _typeFactory .constructType (valueType ));
2337
2299
}
2338
2300
2339
- /**
2340
- * Method for reading sequence of Objects from parser stream.
2341
- */
2342
- @ Override
2343
- public <T > MappingIterator <T > readValues (JsonParser p , TypeReference <?> valueTypeRef )
2344
- throws IOException , JsonProcessingException
2345
- {
2346
- return readValues (p , _typeFactory .constructType (valueTypeRef ));
2347
- }
2348
-
2349
2301
/*
2350
2302
/**********************************************************
2351
2303
/* Public API not included in ObjectCodec: deserialization
@@ -2550,11 +2502,10 @@ public void writeValue(JsonGenerator g, Object value)
2550
2502
2551
2503
/*
2552
2504
/**********************************************************
2553
- /* Public API (from TreeCodec via ObjectCodec) : Tree Model support
2505
+ /* Public API: Tree Model support
2554
2506
/**********************************************************
2555
2507
*/
2556
2508
2557
- @ Override
2558
2509
public void writeTree (JsonGenerator g , TreeNode rootNode )
2559
2510
throws IOException , JsonProcessingException
2560
2511
{
@@ -2586,7 +2537,6 @@ public void writeTree(JsonGenerator g, JsonNode rootNode)
2586
2537
* part of core package, whereas impls are part of mapper
2587
2538
* package)
2588
2539
*/
2589
- @ Override
2590
2540
public ObjectNode createObjectNode () {
2591
2541
return _deserializationConfig .getNodeFactory ().objectNode ();
2592
2542
}
@@ -2598,7 +2548,6 @@ public ObjectNode createObjectNode() {
2598
2548
* part of core package, whereas impls are part of mapper
2599
2549
* package)
2600
2550
*/
2601
- @ Override
2602
2551
public ArrayNode createArrayNode () {
2603
2552
return _deserializationConfig .getNodeFactory ().arrayNode ();
2604
2553
}
@@ -2609,7 +2558,6 @@ public ArrayNode createArrayNode() {
2609
2558
*
2610
2559
* @param n Root node of the tree that resulting parser will read from
2611
2560
*/
2612
- @ Override
2613
2561
public JsonParser treeAsTokens (TreeNode n ) {
2614
2562
DeserializationContext ctxt = createDeserializationContext ();
2615
2563
return new TreeTraversingParser ((JsonNode ) n , ctxt );
@@ -2625,7 +2573,6 @@ public JsonParser treeAsTokens(TreeNode n) {
2625
2573
*</pre>
2626
2574
*/
2627
2575
@ SuppressWarnings ("unchecked" )
2628
- @ Override
2629
2576
public <T > T treeToValue (TreeNode n , Class <T > valueType )
2630
2577
throws JsonProcessingException
2631
2578
{
0 commit comments