|
6 | 6 | import java.io.IOException;
|
7 | 7 | import java.io.OutputStream;
|
8 | 8 | import java.nio.charset.Charset;
|
| 9 | +import java.text.DateFormat; |
9 | 10 |
|
10 | 11 | import javax.xml.stream.XMLInputFactory;
|
11 | 12 | import javax.xml.stream.XMLOutputFactory;
|
|
14 | 15 |
|
15 | 16 | import com.fasterxml.jackson.core.*;
|
16 | 17 | import com.fasterxml.jackson.core.exc.StreamWriteException;
|
| 18 | +import com.fasterxml.jackson.core.io.CharacterEscapes; |
17 | 19 | import com.fasterxml.jackson.core.io.DataOutputAsStream;
|
18 | 20 | import com.fasterxml.jackson.core.type.TypeReference;
|
19 | 21 | import com.fasterxml.jackson.core.util.ByteArrayBuilder;
|
20 | 22 | import com.fasterxml.jackson.databind.*;
|
21 | 23 | import com.fasterxml.jackson.databind.cfg.CoercionAction;
|
22 | 24 | import com.fasterxml.jackson.databind.cfg.CoercionInputShape;
|
| 25 | +import com.fasterxml.jackson.databind.cfg.ContextAttributes; |
23 | 26 | import com.fasterxml.jackson.databind.cfg.MapperBuilder;
|
24 | 27 | import com.fasterxml.jackson.databind.deser.BeanDeserializerFactory;
|
25 | 28 | import com.fasterxml.jackson.databind.jsontype.PolymorphicTypeValidator;
|
26 | 29 | import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
|
| 30 | +import com.fasterxml.jackson.databind.ser.FilterProvider; |
27 | 31 | import com.fasterxml.jackson.databind.type.LogicalType;
|
28 | 32 | import com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser;
|
29 | 33 | import com.fasterxml.jackson.dataformat.xml.deser.XmlDeserializationContext;
|
@@ -313,7 +317,7 @@ public void setXmlNameProcessor(XmlNameProcessor processor) {
|
313 | 317 | public XmlFactory getFactory() {
|
314 | 318 | return (XmlFactory) _jsonFactory;
|
315 | 319 | }
|
316 |
| - |
| 320 | + |
317 | 321 | public ObjectMapper configure(ToXmlGenerator.Feature f, boolean state) {
|
318 | 322 | ((XmlFactory)_jsonFactory).configure(f, state);
|
319 | 323 | return this;
|
@@ -467,6 +471,102 @@ public void writeValue(DataOutput out, Object value, Charset encoding)
|
467 | 471 | _writeValueAndClose(createGenerator(out, encoding), value);
|
468 | 472 | }
|
469 | 473 |
|
| 474 | + @Override |
| 475 | + public ObjectWriter writer() { |
| 476 | + return new XmlWriter(super.writer()); |
| 477 | + } |
| 478 | + |
| 479 | + @Override |
| 480 | + public ObjectWriter writer(SerializationFeature feature) { |
| 481 | + return new XmlWriter(super.writer(feature)); |
| 482 | + } |
| 483 | + |
| 484 | + @Override |
| 485 | + public ObjectWriter writer(SerializationFeature first, SerializationFeature... other) { |
| 486 | + return new XmlWriter(super.writer(first, other)); |
| 487 | + } |
| 488 | + |
| 489 | + @Override |
| 490 | + public ObjectWriter writer(DateFormat df) { |
| 491 | + return new XmlWriter(super.writer(df)); |
| 492 | + } |
| 493 | + |
| 494 | + @Override |
| 495 | + public ObjectWriter writerWithView(Class<?> serializationView) { |
| 496 | + return new XmlWriter(super.writerWithView(serializationView)); |
| 497 | + } |
| 498 | + |
| 499 | + @Override |
| 500 | + public ObjectWriter writerFor(Class<?> rootType) { |
| 501 | + return new XmlWriter(super.writerFor(rootType)); |
| 502 | + } |
| 503 | + |
| 504 | + @Override |
| 505 | + public ObjectWriter writerFor(TypeReference<?> rootType) { |
| 506 | + return new XmlWriter(super.writerFor(rootType)); |
| 507 | + } |
| 508 | + |
| 509 | + @Override |
| 510 | + public ObjectWriter writerFor(JavaType rootType) { |
| 511 | + return new XmlWriter(super.writerFor(rootType)); |
| 512 | + } |
| 513 | + |
| 514 | + @Override |
| 515 | + public ObjectWriter writer(PrettyPrinter pp) { |
| 516 | + return new XmlWriter(super.writer(pp)); |
| 517 | + } |
| 518 | + |
| 519 | + @Override |
| 520 | + public ObjectWriter writerWithDefaultPrettyPrinter() { |
| 521 | + return new XmlWriter(super.writerWithDefaultPrettyPrinter()); |
| 522 | + } |
| 523 | + |
| 524 | + @Override |
| 525 | + public ObjectWriter writer(FilterProvider filterProvider) { |
| 526 | + return new XmlWriter(super.writer(filterProvider)); |
| 527 | + } |
| 528 | + |
| 529 | + @Override |
| 530 | + public ObjectWriter writer(FormatSchema schema) { |
| 531 | + return new XmlWriter(super.writer(schema)); |
| 532 | + } |
| 533 | + |
| 534 | + @Override |
| 535 | + public ObjectWriter writer(Base64Variant defaultBase64) { |
| 536 | + return new XmlWriter(super.writer(defaultBase64)); |
| 537 | + } |
| 538 | + |
| 539 | + @Override |
| 540 | + public ObjectWriter writer(CharacterEscapes escapes) { |
| 541 | + return new XmlWriter(super.writer(escapes)); |
| 542 | + } |
| 543 | + |
| 544 | + @Override |
| 545 | + public ObjectWriter writer(ContextAttributes attrs) { |
| 546 | + return new XmlWriter(super.writer(attrs)); |
| 547 | + } |
| 548 | + |
| 549 | + /** @deprecated */ |
| 550 | + @Override |
| 551 | + @Deprecated |
| 552 | + public ObjectWriter writerWithType(Class<?> rootType) { |
| 553 | + return new XmlWriter(super.writerWithType(rootType)); |
| 554 | + } |
| 555 | + |
| 556 | + /** @deprecated */ |
| 557 | + @Override |
| 558 | + @Deprecated |
| 559 | + public ObjectWriter writerWithType(TypeReference<?> rootType) { |
| 560 | + return new XmlWriter(super.writerWithType(rootType)); |
| 561 | + } |
| 562 | + |
| 563 | + /** @deprecated */ |
| 564 | + @Override |
| 565 | + @Deprecated |
| 566 | + public ObjectWriter writerWithType(JavaType rootType) { |
| 567 | + return new XmlWriter(super.writerWithType(rootType)); |
| 568 | + } |
| 569 | + |
470 | 570 | protected final JsonGenerator createGenerator(OutputStream out, Charset encoding) throws IOException {
|
471 | 571 | this._assertNotNull("out", out);
|
472 | 572 | JsonGenerator g = ((XmlFactory) _jsonFactory).createGenerator(out, encoding);
|
|
0 commit comments