public class ParsedReaderSwap extends PojoSwap<Reader,Object>
Reader
into an Object
.
Reader
must contain JSON, Juneau-generated XML (output from XmlSerializer
), or Juneau-generated
HTML (output from JsonSerializer
) in order to be parsed correctly.
Useful for serializing models that contain Readers
created by RestCall
instances.
This is a one-way transform, since Readers
cannot be reconstituted.
ParsedReaderSwap.Json
- Parses JSON text.
ParsedReaderSwap.Xml
- Parses XML text.
ParsedReaderSwap.Html
- Parses HTML text.
ParsedReaderSwap.PlainText
- Parses plain text.
Modifier and Type | Class and Description |
---|---|
static class |
ParsedReaderSwap.Html
Reader transform for reading HTML text.
|
static class |
ParsedReaderSwap.Json
Reader transform for reading JSON text.
|
static class |
ParsedReaderSwap.PlainText
Reader transform for reading plain text.
|
static class |
ParsedReaderSwap.Uon
Reader transform for reading plain text.
|
static class |
ParsedReaderSwap.UrlEncoding
Reader transform for reading plain text.
|
static class |
ParsedReaderSwap.Xml
Reader transform for reading XML text.
|
Constructor and Description |
---|
ParsedReaderSwap(ReaderParser parser) |
Modifier and Type | Method and Description |
---|---|
Object |
swap(BeanSession session,
Reader o)
|
forMediaTypes, forMediaTypes, getNormalClass, getSwapClass, getSwapClassMeta, isNormalObject, isSwappedObject, match, swap, toString, unswap, unswap, withTemplate, withTemplate
public ParsedReaderSwap(ReaderParser parser)
parser
- The parser to use to convert the contents of the reader to Java objects.public Object swap(BeanSession session, Reader o) throws Exception
swap
in class PojoSwap<Reader,Object>
session
- The bean session to use to get the class meta.
This is always going to be the same bean context that created this swap.o
- The object to be transformed.Exception
- If a problem occurred trying to convert the output.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.