public class MappingIterator<T> extends Object implements Iterator<T>, Closeable
ObjectMapper when binding sequence of
objects. Extension is done to allow more convenient exposing of
IOException (which basic Iterator does not expose)| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_closeParser
Flag that indicates whether input
JsonParser should be closed
when we are done or not; generally only called when caller did not
pass JsonParser. |
protected DeserializationContext |
_context |
protected JsonDeserializer<T> |
_deserializer |
protected boolean |
_hasNextChecked
Flag that is set when we have determined what
hasNextValue()
should value; reset when nextValue() is called |
protected com.fasterxml.jackson.core.JsonParser |
_parser |
protected JavaType |
_type |
protected T |
_updatedValue
If not null, "value to update" instead of creating a new instance
for each call.
|
protected static MappingIterator<?> |
EMPTY_ITERATOR |
| Modifier | Constructor and Description |
|---|---|
protected |
MappingIterator(JavaType type,
com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
JsonDeserializer<?> deser)
Deprecated.
Since 2.1, to be removed
|
protected |
MappingIterator(JavaType type,
com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
JsonDeserializer<?> deser,
boolean managedParser,
Object valueToUpdate) |
| Modifier and Type | Method and Description |
|---|---|
protected <R> R |
_handleIOException(IOException e) |
protected <R> R |
_handleMappingException(JsonMappingException e) |
protected <R> R |
_throwNoSuchElement() |
void |
close() |
protected static <T> MappingIterator<T> |
emptyIterator() |
com.fasterxml.jackson.core.JsonLocation |
getCurrentLocation()
Convenience method, functionally equivalent to:
iterator.getParser().getCurrentLocation()
|
com.fasterxml.jackson.core.JsonParser |
getParser()
Accessor for getting underlying parser this iterator uses.
|
com.fasterxml.jackson.core.FormatSchema |
getParserSchema()
Accessor for accessing
FormatSchema that the underlying parser
(as per getParser()) is using, if any; only parser of schema-aware
formats use schemas. |
boolean |
hasNext() |
boolean |
hasNextValue()
Equivalent of
next() but one that may throw checked
exceptions from Jackson due to invalid input. |
T |
next() |
T |
nextValue() |
List<T> |
readAll()
Convenience method for reading all entries accessible via
this iterator; resulting container will be a
ArrayList. |
<C extends Collection<? super T>> |
readAll(C results)
Convenience method for reading all entries accessible via
this iterator
|
<L extends List<? super T>> |
readAll(L resultList)
Convenience method for reading all entries accessible via
this iterator
|
void |
remove() |
protected static final MappingIterator<?> EMPTY_ITERATOR
protected final JavaType _type
protected final DeserializationContext _context
protected final JsonDeserializer<T> _deserializer
protected com.fasterxml.jackson.core.JsonParser _parser
protected final boolean _closeParser
JsonParser should be closed
when we are done or not; generally only called when caller did not
pass JsonParser.protected boolean _hasNextChecked
hasNextValue()
should value; reset when nextValue() is calledprotected final T _updatedValue
@Deprecated protected MappingIterator(JavaType type, com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt, JsonDeserializer<?> deser)
protected MappingIterator(JavaType type, com.fasterxml.jackson.core.JsonParser jp, DeserializationContext ctxt, JsonDeserializer<?> deser, boolean managedParser, Object valueToUpdate)
managedParser - Whether we "own" the JsonParser passed or not:
if true, it was created by ObjectReader and code here needs to
close it; if false, it was passed by calling code and should not be
closed by iterator.protected static <T> MappingIterator<T> emptyIterator()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean hasNextValue()
throws IOException
next() but one that may throw checked
exceptions from Jackson due to invalid input.IOExceptionpublic T nextValue() throws IOException
IOExceptionpublic List<T> readAll() throws IOException
ArrayList.IOExceptionpublic <L extends List<? super T>> L readAll(L resultList) throws IOException
IOExceptionpublic <C extends Collection<? super T>> C readAll(C results) throws IOException
IOExceptionpublic com.fasterxml.jackson.core.JsonParser getParser()
public com.fasterxml.jackson.core.FormatSchema getParserSchema()
FormatSchema that the underlying parser
(as per getParser()) is using, if any; only parser of schema-aware
formats use schemas.public com.fasterxml.jackson.core.JsonLocation getCurrentLocation()
iterator.getParser().getCurrentLocation()
protected <R> R _throwNoSuchElement()
protected <R> R _handleMappingException(JsonMappingException e)
protected <R> R _handleIOException(IOException e)
Copyright © 2014-2015 FasterXML. All Rights Reserved.