Package com.fasterxml.jackson.databind
Class MappingIterator<T>
java.lang.Object
com.fasterxml.jackson.databind.MappingIterator<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterator<T>
Iterator exposed by
ObjectMapper
when binding sequence of
objects. Extension is done to allow more convenient exposing of
IOException
(which basic Iterator
does not expose)-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static <T> MappingIterator
<T> Method for getting an "empty" iterator instance: one that never has more values; may be freely shared.Convenience method, functionally equivalent to:iterator.getParser().getCurrentLocation()
Accessor for getting underlying parser this iterator uses.Accessor for accessingFormatSchema
that the underlying parser (as pergetParser()
) is using, if any; only parser of schema-aware formats use schemas.boolean
hasNext()
boolean
Equivalent ofnext()
but one that may throw checked exceptions from Jackson due to invalid input.next()
readAll()
Convenience method for reading all entries accessible via this iterator; resulting container will be aArrayList
.<C extends Collection<? super T>>
CreadAll
(C results) Convenience method for reading all entries accessible via this iteratorreadAll
(L resultList) Convenience method for reading all entries accessible via this iteratorvoid
remove()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Method Details
-
emptyIterator
Method for getting an "empty" iterator instance: one that never has more values; may be freely shared.- Since:
- 2.10 Existed earlier but
public
since 2.10
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
hasNextValue
Equivalent ofnext()
but one that may throw checked exceptions from Jackson due to invalid input.- Throws:
IOException
-
nextValue
- Throws:
IOException
-
readAll
Convenience method for reading all entries accessible via this iterator; resulting container will be aArrayList
.- Returns:
- List of entries read
- Throws:
IOException
- Since:
- 2.2
-
readAll
Convenience method for reading all entries accessible via this iterator- Returns:
- List of entries read (same as passed-in argument)
- Throws:
IOException
- Since:
- 2.2
-
readAll
Convenience method for reading all entries accessible via this iterator- Throws:
IOException
- Since:
- 2.5
-
getParser
Accessor for getting underlying parser this iterator uses.- Since:
- 2.2
-
getParserSchema
Accessor for accessingFormatSchema
that the underlying parser (as pergetParser()
) is using, if any; only parser of schema-aware formats use schemas.- Since:
- 2.2
-
getCurrentLocation
Convenience method, functionally equivalent to:iterator.getParser().getCurrentLocation()
- Returns:
- Location of the input stream of the underlying parser
- Since:
- 2.2.1
-