JsonParser implementation that exposes XML structure as
set of JSON events that can be used for data binding.
| Modifier and Type | Field and Description |
|---|---|
| protected byte[] | _binaryValue
We will hold on to decoded binary data, for duration of
current event, so that multiple calls to
|
| protected ByteArrayBuilder | _byteArrayBuilder
ByteArrayBuilder is needed if 'getBinaryValue' is called. |
| protected final String | _cfgNameForTextElement
In cases where a start element has both attributes and non-empty textual value, we have to create a bogus property; we will use this as the property name. |
| protected String | |
| protected final int | _formatFeatures
Bit flag composed of bits that indicate which
|
| protected boolean | _mayBeLeaf
We need special handling to keep track of whether a value may be exposed as simple leaf value. |
| protected boolean | _nextIsLeadingMixed
Additional flag that is strictly needed when exposing "mixed" leading String value as "anonymous" property/string pair. |
| protected JsonToken | |
| protected BigInteger | |
| protected int | |
| protected long | |
| protected int | _numTypesValid
Bit field that indicates which numeric representations have been calculated for the current type |
| protected XmlReadContext | _streamReadContext
Information about parser context, context in which the next token is to be parsed (root, array, object). |
| protected final XmlTokenStream | |
| public static final String | DEFAULT_UNNAMED_TEXT_PROPERTY
The default name placeholder for XML text segments is empty String (""). |
| protected static final JacksonFeatureSet | XML_READ_CAPABILITIES
XML format has some peculiarities, indicated via capability system. |
| Access | Constructor and Description |
|---|---|
| public | FromXmlParser(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int xmlFeatures, XMLStreamReader xmlReader, XmlNameProcessor nameProcessor, String nameForTextElement)
|
| public | FromXmlParser(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int xmlFeatures, XMLStreamReader xmlReader, XmlTokenStream tokenStream, XmlNameProcessor nameProcessor, String nameForTextElement)
|
| Modifier and Type | Method and Description |
|---|---|
| protected final void | |
| protected void | _closeInput()
Implements abstract tools. Abstract method for sub-classes to implement; to be called by
|
| protected BigDecimal | |
| protected void | |
| protected double | |
| protected float | |
| protected void | |
| protected void | |
| protected byte[] | |
| protected ByteArrayBuilder | |
| protected void | _handleEOF()
Implements abstract tools. Method called when an EOF is encountered between tokens. |
| private <T> T | |
| protected final int | |
| protected int | |
| protected void | _releaseBuffers()
Implements abstract tools. Method called to release internal buffers owned by the base reader. |
| protected void | |
| private void | |
| public void | addVirtualWrapping(Set<String> namesToWrap0, boolean caseInsensitive)
Implements tools. Method that may be called to indicate that specified names (only local parts retained currently: this may be changed in future) should be considered "auto-wrapping", meaning that they will be doubled to contain two opening elements, two matching closing elements. |
| public void | assignCurrentValue(Object v)
Implements abstract tools. Helper method, usually equivalent to:
|
| public boolean | canReadObjectId()
Overrides tools. Introspection method that may be called to see if the underlying data format supports some kind of Object Ids natively (many do not; for example, JSON doesn't). |
| public boolean | canReadTypeId()
Overrides tools. Introspection method that may be called to see if the underlying data format supports some kind of Type Ids natively (many do not; for example, JSON doesn't). |
| public TokenStreamLocation | currentLocation()
Implements abstract tools. Method that returns location of the last processed character; usually for error reporting purposes |
| public String | currentName()
Implements abstract tools. Method that can be called to get the name associated with the current event. |
| public TokenStreamLocation | currentTokenLocation()
Implements abstract tools. Method that return the starting location of the current token; that is, position of the first character from input that starts the current token. |
| public Object | currentValue()
Implements abstract tools. Helper method, usually equivalent to:
Note that "current value" is NOT populated (or used) by Streaming parser; it is only used by higher-level data-binding functionality. |
| public BigInteger | getBigIntegerValue()
Implements abstract tools. Numeric accessor that can be called when the current
token is of type |
| public byte[] | getBinaryValue(Base64Variant b64variant)
Implements abstract tools. Method that can be used to read (and consume -- results may not be accessible using other methods after the call) base64-encoded binary data included in the current textual JSON value. |
| public BigDecimal | getDecimalValue()
Implements abstract tools. Numeric accessor that can be called when the current
token is of type |
| public double | getDoubleValue()
Implements abstract tools. Numeric accessor that can be called when the current
token is of type |
| public Object | getEmbeddedObject()
Overrides tools. Accessor that can be called if (and only if) the current token
is |
| public float | getFloatValue()
Implements abstract tools. Numeric accessor that can be called when the current
token is of type |
| public int | getIntValue()
Implements abstract tools. Numeric accessor that can be called when the current
token is of type |
| public long | getLongValue()
Implements abstract tools. Numeric accessor that can be called when the current
token is of type |
| public JsonParser. | getNumberType()
Implements abstract tools. If current token is of type
|
| public Number | getNumberValue()
Implements abstract tools. Generic number value accessor method that will work for all kinds of numeric values. |
| public XMLStreamReader | |
| public String | getString()
Implements abstract tools. Method for accessing textual representation of the current token;
if no current token (before first call to |
| public int | getString(Writer writer)
Overrides tools. Method to read the textual representation of the current token in chunks and pass it to the given Writer. |
| public char[] | getStringCharacters()
Implements abstract tools. Method similar to |
| public int | getStringLength()
Implements abstract tools. Accessor used with |
| public int | getStringOffset()
Implements abstract tools. Accessor used with |
| public boolean | hasStringCharacters()
Implements abstract tools. XML input actually would offer access to character arrays; but since we must coalesce things it cannot really be exposed. |
| public final boolean | |
| public boolean | isExpectedNumberIntToken()
Overrides tools. Since xml representation cannot really distinguish between different scalar types (numbers, booleans) -- they are all just Character Data, without schema -- we can try to infer type from intent here. |
| public boolean | isExpectedStartArrayToken()
Overrides tools. Since xml representation cannot really distinguish between array and object starts (both are represented with elements), this method is overridden and taken to mean that expectation is that the current start element is to mean 'start array', instead of default of 'start object'. |
| public boolean | isNaN()
Implements abstract tools. Accessor for checking whether current token is a special "not-a-number" (NaN) token (including both "NaN" AND positive/negative infinity!). |
| public String | nextStringValue()
Overrides tools. Method overridden to support more reliable deserialization of String collections. |
| public JsonToken | nextToken()
Implements abstract tools. Main iteration method, which will advance stream enough to determine type of the next token, if any. |
| public JacksonFeatureSet | streamReadCapabilities()
Overrides tools. Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly). |
| public TokenStreamContext | streamReadContext()
Implements abstract tools. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. |
| public XMLStreamReader2 | streamReadInputSource()
Implements abstract tools. Method that can be used to get access to object that is used
to access input being parsed; this is usually either
|
| public Version | version()
Implements abstract tools. Implements tools. Accessor for getting version of the core package, given a parser instance. |
| _binaryValue | back to summary |
|---|---|
| protected byte[] _binaryValue We will hold on to decoded binary data, for duration of
current event, so that multiple calls to
| |
| _byteArrayBuilder | back to summary |
|---|---|
| protected ByteArrayBuilder _byteArrayBuilder ByteArrayBuilder is needed if 'getBinaryValue' is called. If so, we better reuse it for remainder of content. | |
| _cfgNameForTextElement | back to summary |
|---|---|
| protected final String _cfgNameForTextElement In cases where a start element has both attributes and non-empty textual value, we have to create a bogus property; we will use this as the property name. Name used for pseudo-property used for returning XML Text value (which does not have actual element name to use). Defaults to empty String, but may be changed for inter-operability reasons: JAXB, for example, uses "value" as name. | |
| _currText | back to summary |
|---|---|
| protected String _currText | |
| _formatFeatures | back to summary |
|---|---|
| protected final int _formatFeatures Bit flag composed of bits that indicate which
| |
| _mayBeLeaf | back to summary |
|---|---|
| protected boolean _mayBeLeaf We need special handling to keep track of whether a value may be exposed as simple leaf value. | |
| _nextIsLeadingMixed | back to summary |
|---|---|
| protected boolean _nextIsLeadingMixed Additional flag that is strictly needed when exposing "mixed" leading
String value as "anonymous" property/string pair. If so, code returns
START_OBJECT first, sets | |
| _nextToken | back to summary |
|---|---|
| protected JsonToken _nextToken | |
| _numberBigInt | back to summary |
|---|---|
| protected BigInteger _numberBigInt | |
| _numberInt | back to summary |
|---|---|
| protected int _numberInt | |
| _numberLong | back to summary |
|---|---|
| protected long _numberLong | |
| _numTypesValid | back to summary |
|---|---|
| protected int _numTypesValid Bit field that indicates which numeric representations have been calculated for the current type | |
| _streamReadContext | back to summary |
|---|---|
| protected XmlReadContext _streamReadContext Information about parser context, context in which the next token is to be parsed (root, array, object). | |
| _xmlTokens | back to summary |
|---|---|
| protected final XmlTokenStream _xmlTokens | |
| DEFAULT_UNNAMED_TEXT_PROPERTY | back to summary |
|---|---|
| public static final String DEFAULT_UNNAMED_TEXT_PROPERTY The default name placeholder for XML text segments is empty String (""). | |
| XML_READ_CAPABILITIES | back to summary |
|---|---|
| protected static final JacksonFeatureSet<StreamReadCapability> XML_READ_CAPABILITIES XML format has some peculiarities, indicated via capability system. | |
| FromXmlParser | back to summary |
|---|---|
| public FromXmlParser(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int xmlFeatures, XMLStreamReader xmlReader, XmlNameProcessor nameProcessor, String nameForTextElement) | |
| FromXmlParser | back to summary |
|---|---|
| public FromXmlParser(ObjectReadContext readCtxt, IOContext ioCtxt, int parserFeatures, int xmlFeatures, XMLStreamReader xmlReader, XmlTokenStream tokenStream, XmlNameProcessor nameProcessor, String nameForTextElement) | |
| _checkNumericValue | back to summary |
|---|---|
| protected final void _checkNumericValue(int expType) throws JacksonException | |
| _closeInput | back to summary |
|---|---|
| protected void _closeInput() throws IOException Implements abstract tools. Doc from tools. Abstract method for sub-classes to implement; to be called by
| |
| _convertNumberToBigDecimal | back to summary |
|---|---|
| protected BigDecimal _convertNumberToBigDecimal() throws JacksonException | |
| _convertNumberToBigInteger | back to summary |
|---|---|
| protected void _convertNumberToBigInteger() throws JacksonException | |
| _convertNumberToDouble | back to summary |
|---|---|
| protected double _convertNumberToDouble() throws JacksonException | |
| _convertNumberToFloat | back to summary |
|---|---|
| protected float _convertNumberToFloat() throws JacksonException | |
| _convertNumberToInt | back to summary |
|---|---|
| protected void _convertNumberToInt() throws JacksonException | |
| _convertNumberToLong | back to summary |
|---|---|
| protected void _convertNumberToLong() throws JacksonException | |
| _decodeBase64 | back to summary |
|---|---|
protected byte[] _decodeBase64(Base64Variant b64variant) throws JacksonException
| |
| _getByteArrayBuilder | back to summary |
|---|---|
| protected ByteArrayBuilder _getByteArrayBuilder() | |
| _handleEOF | back to summary |
|---|---|
| protected void _handleEOF() throws StreamReadException Implements abstract tools. Method called when an EOF is encountered between tokens. If so, it may be a legitimate EOF, but only iff there is no open non-root context.
| |
| _internalErrorUnknownToken | back to summary |
|---|---|
| private <T> T _internalErrorUnknownToken(Object token) | |
| _isIntNumber | back to summary |
|---|---|
| protected final int _isIntNumber(String text) | |
| _nextToken | back to summary |
|---|---|
| protected int _nextToken() throws JacksonException | |
| _releaseBuffers | back to summary |
|---|---|
| protected void _releaseBuffers() Implements abstract tools. Doc from tools. Method called to release internal buffers owned by the base
reader. This is expected to be called after
| |
| _skipEndElement | back to summary |
|---|---|
| protected void _skipEndElement() throws JacksonException | |
| _updateState | back to summary |
|---|---|
| private void _updateState(JsonToken t) | |
| addVirtualWrapping | back to summary |
|---|---|
| public void addVirtualWrapping(Set<String> namesToWrap0, boolean caseInsensitive) Implements tools. Doc from tools. Method that may be called to indicate that specified names (only local parts retained currently: this may be changed in future) should be considered "auto-wrapping", meaning that they will be doubled to contain two opening elements, two matching closing elements. This is needed for supporting handling of so-called "unwrapped" array types, something XML mappings like JAXB often use.
| |
| assignCurrentValue | back to summary |
|---|---|
| public void assignCurrentValue(Object v) Implements abstract tools. Doc from tools. Helper method, usually equivalent to:
| |
| canReadObjectId | back to summary |
|---|---|
| public boolean canReadObjectId() Overrides tools. Doc from tools. Introspection method that may be called to see if the underlying data format supports some kind of Object Ids natively (many do not; for example, JSON doesn't). Default implementation returns true; overridden by data formats that do support native Object Ids. Caller is expected to either use a non-native notation (explicit property or such), or fail, in case it cannot use native object ids.
| |
| canReadTypeId | back to summary |
|---|---|
| public boolean canReadTypeId() Overrides tools. Doc from tools. Introspection method that may be called to see if the underlying data format supports some kind of Type Ids natively (many do not; for example, JSON doesn't). Default implementation returns true; overridden by data formats that do support native Type Ids. Caller is expected to either use a non-native notation (explicit property or such), or fail, in case it cannot use native type ids.
| |
| currentLocation | back to summary |
|---|---|
| public TokenStreamLocation currentLocation() Implements abstract tools. Method that returns location of the last processed character; usually for error reporting purposes
| |
| currentName | back to summary |
|---|---|
| public String currentName() Implements abstract tools. Method that can be called to get the name associated with the current event.
| |
| currentTokenLocation | back to summary |
|---|---|
| public TokenStreamLocation currentTokenLocation() Implements abstract tools. Method that return the starting location of the current token; that is, position of the first character from input that starts the current token.
| |
| currentValue | back to summary |
|---|---|
| public Object currentValue() Implements abstract tools. Doc from tools. Helper method, usually equivalent to:
Note that "current value" is NOT populated (or used) by Streaming parser; it is only used by higher-level data-binding functionality. The reason it is included here is that it can be stored and accessed hierarchically, and gets passed through data-binding.
| |
| getBigIntegerValue | back to summary |
|---|---|
| public BigInteger getBigIntegerValue() throws JacksonException Implements abstract tools. Doc from tools. Numeric accessor that can be called when the current
token is of type
| |
| getBinaryValue | back to summary |
|---|---|
| public byte[] getBinaryValue(Base64Variant b64variant) throws JacksonException Implements abstract tools. Doc from tools. Method that can be used to read (and consume -- results
may not be accessible using other methods after the call)
base64-encoded binary data
included in the current textual JSON value.
It works similar to getting String value via Note that non-decoded textual contents of the current token are not guaranteed to be accessible after this method is called. Current implementation, for example, clears up textual content during decoding. Decoded binary content, however, will be retained until parser is advanced to the next event.
| |
| getDecimalValue | back to summary |
|---|---|
| public BigDecimal getDecimalValue() throws JacksonException Implements abstract tools. Doc from tools. Numeric accessor that can be called when the current
token is of type
| |
| getDoubleValue | back to summary |
|---|---|
| public double getDoubleValue() throws JacksonException Implements abstract tools. Doc from tools. Numeric accessor that can be called when the current
token is of type Note if the value falls
outside of range of Java double, a
| |
| getEmbeddedObject | back to summary |
|---|---|
| public Object getEmbeddedObject() throws JacksonException Overrides tools. Doc from tools. Accessor that can be called if (and only if) the current token
is Note only some specialized parser implementations support
embedding of objects (usually ones that are facades on top
of non-streaming sources, such as object trees). One exception
is access to binary content (whether via base64 encoding or not)
which typically is accessible using this method, as well as
| |
| getFloatValue | back to summary |
|---|---|
| public float getFloatValue() throws JacksonException Implements abstract tools. Doc from tools. Numeric accessor that can be called when the current
token is of type Note if the value falls
outside of range of Java float, a
| |
| getIntValue | back to summary |
|---|---|
| public int getIntValue() throws JacksonException Implements abstract tools. Doc from tools. Numeric accessor that can be called when the current
token is of type Note if the resulting integer value falls outside range of
Java
| |
| getLongValue | back to summary |
|---|---|
| public long getLongValue() throws JacksonException Implements abstract tools. Doc from tools. Numeric accessor that can be called when the current
token is of type Note if the token is an integer, but its value falls
outside of range of Java long, a
| |
| getNumberType | back to summary |
|---|---|
| public JsonParser. Implements abstract tools. Doc from tools. If current token is of type
Note in Jackson 2.x, an exception was wrong if called for non-numeric token.
| |
| getNumberValue | back to summary |
|---|---|
| public Number getNumberValue() throws JacksonException Implements abstract tools. Doc from tools. Generic number value accessor method that will work for all kinds of numeric values. It will return the optimal (simplest/smallest possible) wrapper object that can express the numeric value just parsed.
| |
| getStaxReader | back to summary |
|---|---|
| public XMLStreamReader getStaxReader() Method that allows application direct access to underlying
Stax Note writer instance will always be of type
| |
| getString | back to summary |
|---|---|
| public String getString() throws JacksonException Implements abstract tools. Doc from tools. Method for accessing textual representation of the current token;
if no current token (before first call to
| |
| getString | back to summary |
|---|---|
| public int getString(Writer writer) throws JacksonException Overrides tools. Doc from tools. Method to read the textual representation of the current token in chunks and pass it to the given Writer. Functionally same as calling: writer.write(parser.getString());but should typically be more efficient as longer content does need to be combined into a single String to return, and write
can occur directly from intermediate buffers Jackson uses.Note String value will still be buffered (usually
using Note In Jackson 2.x this method was called
| |
| getStringCharacters | back to summary |
|---|---|
| public char[] getStringCharacters() throws JacksonException Implements abstract tools. Doc from tools. Method similar to
Note that caller MUST NOT modify the returned character array in any way -- doing so may corrupt current parser state and render parser instance useless.
The only reason to call this method (over
| |
| getStringLength | back to summary |
|---|---|
| public int getStringLength() throws JacksonException Implements abstract tools. Doc from tools. Accessor used with
| |
| getStringOffset | back to summary |
|---|---|
| public int getStringOffset() throws JacksonException Implements abstract tools. Doc from tools. Accessor used with
| |
| hasStringCharacters | back to summary |
|---|---|
| public boolean hasStringCharacters() Implements abstract tools. XML input actually would offer access to character arrays; but since we must coalesce things it cannot really be exposed.
| |
| isEnabled | back to summary |
|---|---|
| public final boolean isEnabled(XmlReadFeature f) | |
| isExpectedNumberIntToken | back to summary |
|---|---|
| public boolean isExpectedNumberIntToken() Overrides tools. Since xml representation cannot really distinguish between different scalar types (numbers, booleans) -- they are all just Character Data, without schema -- we can try to infer type from intent here. The main benefit is avoiding checks for coercion.
| |
| isExpectedStartArrayToken | back to summary |
|---|---|
| public boolean isExpectedStartArrayToken() Overrides tools. Since xml representation cannot really distinguish between array and object starts (both are represented with elements), this method is overridden and taken to mean that expectation is that the current start element is to mean 'start array', instead of default of 'start object'.
| |
| isNaN | back to summary |
|---|---|
| public boolean isNaN() Implements abstract tools. Doc from tools. Accessor for checking whether current token is a special
"not-a-number" (NaN) token (including both "NaN" AND
positive/negative infinity!). These values are not supported by all formats:
JSON, for example, only supports them if
Note in case where numeric value is outside range of requested type --
most notably
| |
| nextStringValue | back to summary |
|---|---|
| public String nextStringValue() throws JacksonException Overrides tools. Method overridden to support more reliable deserialization of String collections.
| |
| nextToken | back to summary |
|---|---|
| public JsonToken nextToken() throws JacksonException Implements abstract tools. Doc from tools. Main iteration method, which will advance stream enough to determine type of the next token, if any. If none remaining (stream has no content other than possible white space before ending), null will be returned.
| |
| streamReadCapabilities | back to summary |
|---|---|
| public JacksonFeatureSet Overrides tools. Doc from tools. Accessor for getting metadata on capabilities of this parser, based on underlying data format being read (directly or indirectly).
| |
| streamReadContext | back to summary |
|---|---|
| public TokenStreamContext streamReadContext() Implements abstract tools. Doc from tools. Method that can be used to access current parsing context reader is in. There are 3 different types: root, array and object contexts, with slightly different available information. Contexts are hierarchically nested, and can be used for example for figuring out part of the input document that correspond to specific array or object (for highlighting purposes, or error reporting). Contexts can also be used for simple xpath-like matching of input, if so desired. Note method was called
| |
| streamReadInputSource | back to summary |
|---|---|
| public XMLStreamReader2 streamReadInputSource() Implements abstract tools. Doc from tools. Method that can be used to get access to object that is used
to access input being parsed; this is usually either
In general use of this accessor should be considered as "last effort", i.e. only used if no other mechanism is applicable. Note was named
| |
| version | back to summary |
|---|---|
| public Version version() Implements abstract tools. Implements tools. Doc from tools. Accessor for getting version of the core package, given a parser instance. Left for sub-classes to implement.
| |