Package nl.vpro.jackson2
Class JsonArrayIterator.Builder<T>
- java.lang.Object
-
- nl.vpro.jackson2.JsonArrayIterator.Builder<T>
-
- Enclosing class:
- JsonArrayIterator<T>
public static class JsonArrayIterator.Builder<T> extends Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonArrayIterator<T>build()JsonArrayIterator.Builder<T>callback(@Nullable Runnable callback)JsonArrayIterator.Builder<T>inputStream(@NonNull InputStream inputStream)JsonArrayIterator.Builder<T>logger(@Nullable org.slf4j.Logger logger)JsonArrayIterator.Builder<T>objectMapper(@Nullable com.fasterxml.jackson.databind.ObjectMapper objectMapper)JsonArrayIterator.Builder<T>sizeField(@Nullable String sizeField)JsonArrayIterator.Builder<T>skipNulls(@Nullable Boolean skipNulls)StringtoString()JsonArrayIterator.Builder<T>totalSizeField(@Nullable String totalSizeField)JsonArrayIterator.Builder<T>valueClass(@Nullable Class<T> valueClass)JsonArrayIterator.Builder<T>valueCreator(@Nullable BiFunction<com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.core.TreeNode,T> valueCreator)
-
-
-
Method Detail
-
inputStream
public JsonArrayIterator.Builder<T> inputStream(@NonNull InputStream inputStream)
- Parameters:
inputStream- The inputstream containing the json- Returns:
this.
-
valueCreator
public JsonArrayIterator.Builder<T> valueCreator(@Nullable BiFunction<com.fasterxml.jackson.core.JsonParser,com.fasterxml.jackson.core.TreeNode,T> valueCreator)
- Parameters:
valueCreator- A function which converts a jsonTreeNodeto the desired objects in the iterator.- Returns:
this.
-
valueClass
public JsonArrayIterator.Builder<T> valueClass(@Nullable Class<T> valueClass)
- Parameters:
valueClass- If valueCreator is not given, simply the class of the desired object can be given Json unmarshalling with the given objectMapper will happen.- Returns:
this.
-
callback
public JsonArrayIterator.Builder<T> callback(@Nullable Runnable callback)
- Parameters:
callback- If the iterator is ready, closed or error this callback will be called.- Returns:
this.
-
sizeField
public JsonArrayIterator.Builder<T> sizeField(@Nullable String sizeField)
- Parameters:
sizeField- The size of the iterator, i.e. the size of the array represented in the json stream- Returns:
this.
-
totalSizeField
public JsonArrayIterator.Builder<T> totalSizeField(@Nullable String totalSizeField)
- Parameters:
totalSizeField- Sometimes the array is part of something bigger, e.g. a page in a search result. The size of the 'complete' result can be in the beginning of the json in this field.- Returns:
this.
-
objectMapper
public JsonArrayIterator.Builder<T> objectMapper(@Nullable com.fasterxml.jackson.databind.ObjectMapper objectMapper)
- Parameters:
objectMapper- Default the objectMapperJackson2Mapper.getLenientInstance()will be used (in conjuction withvalueClass, but you may specify another one- Returns:
this.
-
logger
public JsonArrayIterator.Builder<T> logger(@Nullable org.slf4j.Logger logger)
- Parameters:
logger- Default this is logging to nl.vpro.jackson2.JsonArrayIterator, but you may override that.- Returns:
this.
-
skipNulls
public JsonArrayIterator.Builder<T> skipNulls(@Nullable Boolean skipNulls)
- Returns:
this.
-
build
public JsonArrayIterator<T> build() throws IOException
- Throws:
IOException
-
-